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

Re: Announcing Perl 7

Thread Previous | Thread Next
From:
book
Date:
June 25, 2020 12:04
Subject:
Re: Announcing Perl 7
Message ID:
20200625120357.GE19414@kapow
On Thu, Jun 25, 2020 at 09:16:20AM +0100, Dave Mitchell wrote:
> On Wed, Jun 24, 2020 at 11:49:30PM +0300, Sawyer X wrote:
> > * Major versions will be used for two purposes: 1. Turn on features
> > and pragmas by default, 2. Remove syntax from the language.
> 
> 
> I think if people want to use the new modern perl, they just put this
> one simple line at the top of their code:
> 
>     use v7;

In my understanding, the goal of the new Perl is to cut off the
maintenance burden of the old code.

Both Perl code on the outside and code inside perl.  

Having old code run unmodified under Perl 7 doesn't achieve that,
as newer Perls will have to support unqualified Perl code forever.

I think there's a very simple way to:
- make Perl 7 code not work under perl5
- make Perl 5 code stop working under perl7

And this way is: `use v7`, but _mandatory_.
Make newer Perls _demand_ you know which version your code target.

If all Perl 7 code files _have_ to start with `use v7` (still better
than the dozens of lines of boilerplate Sawyer showed during his talk),
then:

    $ cat   perl5-code.pl
    1;
    $ perl5 perl5-code.pl
    $ perl7 perl5-code.pl
    Unversioned Perl code is not supported--this is v7.0.0, stopped at perl5-code.pl line 1.
    $ cat   perl7-code.pl
    use v7;
    1;
    $ perl5 perl7-script.pl
    Perl v7.0.0 required--this is only v5.8.9, stopped at -e line 1.                                                  
    $ perl7 perl7-code.pl
    $

Demanding a `use vX` for any major Perl version after and including 7
also makes the transition to 8, 9 and 10 much easier. Broken features
can be dropped between major versions, and the transition to major
versions has to be conscious. vX can decide how many previous major
versions it will transparently support.

    $ perl9 perl7-script.pl
    Perl v7 code is not supported--this is v9.0.0, supporting Perl versions down to 8.0.0, stopped at perl7-script.pl line 1.                                                  

-- 
 Philippe Bruhat (BooK)

 When you double-cross a friend, you triple-cross yourself.
                                     (Moral from Groo The Wanderer #8 (Epic))

Thread Previous | 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