develooper Front page | perl.perl5.porters | Postings from June 2020

Moving forward on `v7`

Thread Next
From:
Paul "LeoNerd" Evans
Date:
June 27, 2020 23:42
Subject:
Moving forward on `v7`
Message ID:
20200628004239.76c62bb2@shy.leonerd.org.uk
TL;DR - lets try "use v7" for now as a way to experiment incrementally
  on a per-file basis before we flip the world


I've been thinking on two separate problems and I think we can solve
them all in one go. Please bear with me.

There's quite a bit of consternation at the moment regarding the v7
plan, specifically on whether we will require files to begin "use v7"
or not. There's many plausible-sounding words on both sides, but very
little hard data. Meanwhile, I don't really feel that there's much of
concrete way to test it out yet for real in real-life situations, so
there's no way to obtain that data. I think we can fix both together.

Why don't we make a little change such that we can

  use v7;

anyway for now, even if we still aim that an eventual perl7 won't
*require* that in every file. 

This way, we can test out what it feels like to put that in every file.
We can also work incrementally. I verymuch doubt we will be able to
*atomically* adapt every single `.pm` file that ships with core into 7
support in one giant leap. Instead, we can work in small incremental
steps - adding a `use v7;` line piecewise to each individual file that
we find works fine with it, gradually whittling down the files still
missing it, but knowing that at any point along the way we still have a
consistent tree that actually works.

If we get to the end of the process and every single file in the perl
core source tree now contains `use v7;` then great - we'll know we core
at least can support 7 mode. At that point we could just flip a few
bits in the core binary to have it start by default in that mode and
ship it as perl 7. It won't matter that every file still contains
`use v7` at that point, because when loaded by a perl7 binary that will
be a no-op, and if perl5 attempts to load it it will complain loudly
anyway. So we'll be good all round.

But *until* then, we still have a playground to work with
incrementally, seeing what works and what doesn't.

I for one am keen to start trying out this v7 mode on a purely opt-in
basis in some of my files anyway, so I'd hate to have to switch the
entire world at one go just to start experimenting in a few places.

In addition, I do hope that "use v7" is at least allowed in such files,
and becomes relatively normal to do so because I again I want to
reïterate my point about syntax highlight. It would be great if github,
vim/emacs/etc.. could highlight perl 7 code correctly. It needs *a*
signal to do so, and it can't take that from the filename alone. There
is precedent for being able to use in-file clues to do that - "use v7"
can easily be such a clue. Even if "use v7" becomes optional to the
perl7 binary, I will still continue to declare "use v7" in all my code
so as to get the correct highlighting and other editor semantics when
working on it.

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About