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

Re: use v5.36; use warnings;

Thread Previous | Thread Next
From:
Ricardo Signes
Date:
June 18, 2021 19:25
Subject:
Re: use v5.36; use warnings;
Message ID:
f7d6c048-d233-411b-a5f9-b4c57df4cadd@beta.fastmail.com
On Sun, Jun 6, 2021, at 8:03 PM, Ricardo Signes wrote:
> I think I need to give it a big think, but here's the reasoning as I was able to quickly swap it back in:
> 
> […]
> At ten years' remove, I'm not sure what I think of this decision anymore, but I urge you to read the reasoning behind it before coming to a conclusion.

If you don't know what I'm quoting, I urge you to read my previous message and, just maybe, the 2011-ish thread it's summarizing.

This topic got a bunch of PSC discussion.  In the end, I promised to write things up, so here I am.

The idea, as I summarized previously, was that we wanted to make "use v5.40" work like "reset to defaults, then turn on all the v5.40 stuff".  This meant that:
 * "use v5.10" means "use feature 'say'" so "use v5.8" should mean "no feature 'say'"
 * so similarly: "use v5.12" means "use strict" so "use v5.10" should mean "no strict"
 * but some people had already been writing "use strict; use warnings; use v5.10.0" and we didn't want to hurt them

The point I advocated in a call with Neil and Nick was that our real problem was not clearly defining the *kinds* of actions that "use vX" might take.  We acted like it took one action:  "alter the semantics of the scope."   But some of those actions were hard to rationalize, especially after the fact.  Then, we left some things surprising:  If you say "no feature 'say'; use v5.10" you'll end up with say enabled.  So, "use feature" is not sticky in the same way that "use strict" is.

I think this whole thing was a mess, and it was a mess on my watch, and I regret it.

I think we should declare that "use vX" does this:
 * use feature ":default"; use feature ":X";
 * use xyz; (for various xyz);
That means it would unconditionally turn on strict.  If we add warnings, it will unconditionally turn on warnings.

Right now, I believe the *only* effect this will have is that code which has says "no strict; use v5.12.0", which would now begin turning on strictures.  We can detect this, for now, and issue a deprecation-style "this will turn on warnings in v5.40" starting in v5.36, but can begin having "use warnings" follow this rule from the start.

I think this is the right way to go, even though it's a bit of a pain.

-- 
rjbs
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