Front page | perl.perl5.porters |
Postings from June 2020
Re: Announcing Perl 7
Thread Previous
|
Thread Next
From:
Darren Duncan
Date:
June 30, 2020 04:40
Subject:
Re: Announcing Perl 7
Message ID:
cf690841-bc70-a8ae-338d-2d88a085c59b@darrenduncan.net
Having taken more time to think about this, and seeing more discussion, I have
come around further towards supporting a key aspect of Sawyer's proposal.
1. I no longer believe that a v7+ Perl interpreter should consider it mandatory
for each Perl file to start with a "use <version>;" and instead I take the
position that using such declarations should just be strongly encouraged,
particularly for any Perl code meant to be shared with others.
2. I also completely agree that IF Perl code lacks an explicit version marker,
then a v7+ Perl interpreter should indeed interpret it as the latest version of
Perl it understands implicitly, rather than interpreting it as Perl 5.0.0.
3. I still think the long-existing way of declaring versions should continue to
be used as THE way to distinguish Perl 5 from 7+, such as "use 5.012;" or "use
7.0;", and that "use compat::Perl5" or whatever is an inferior option. When we
have explicit markers we want it to be something older Perl will do the right
thing with.
This way, the simplest and private use cases of Perl would have no explicit
versions, and one starts using explicit versions as a recommended best practice
once code becomes non-trivial in size or is intended to be shared with others,
including everything published on CPAN.
I still think we should not be trying to discourage explicit version markers;
their use should still be encouraged, but maybe just isn't one of the first
things you tell a new user, and include it in what you tell them when you say,
okay you want to share your code with others, this will make that work better.
-- Darren Duncan
On 2020-06-28 6:05 p.m., Darren Duncan wrote:
> I feel the best all-around solution here is for the Perl interpreter as of
> version 7.0.0 to make it mandatory to have the "use N;" (where N is a version
> number) tiny boilerplate at the top of each Perl file it runs.
>
> This boilerplate has the same meaning it always had but it is now mandatory
> rather than optional.
>
> This simple solution is a have our cake and eat it too thing.
>
> By forcing a declaration, authors explicitly say what baseline behavior that
> they expect, and that can either be 5 or 7, but they say it explicitly.
>
> Then the discussion is no longer the contentious what do you get when no version
> is specified, but rather what reasonable action does the Perl 7+ interpreter
> take when encountering a particular version declaration. Most of the discussion
> here then is that the default behavior of Perl interpreter 7 is what happens
> when "use 7" is in a file.
>
> Perl 5 code with appropriate "use 5" will continue to behave as it did before
> under a Perl 5 interpreter, and the Perl 7 interpreter will also permit it to
> run, and know what is expected.
>
> The Perl 7+ interpreters can still remove older features so that certain Perl 5
> code will no longer run, but in that case they can separately give the error
> that eg 5.6 behavior is not supported, and the error can be customized based on
> the file's declared version that indicated what the author expected.
>
> See https://www.nntp.perl.org/group/perl.perl5.porters/2020/06/msg257607.html
> where I previously talked about this at greater length. I'm saying this again
> as I feel my prior message may not have been seen in the haystack or because I
> wasn't subscribed to the list then but now I am.
>
> If we simply get away from the idea that Perl is best without any version
> declaration at all, the better off we'll be.
>
> -- Darren Duncan
Thread Previous
|
Thread Next