Mailing List Archive

use v5.36; use warnings;
Porters,

Here's an almost simple one:

I propose that `use v5.36` turns on, in addition to strictures and the feature bundle, warnings. Specifically, behaves the same as "use warnings".

I'm torn on whether I think it should behave like the "use vX" behavior of strict, whereby "no strict; use v5.30" does NOT enable strictures. Probably, just for the sake of reducing the number of exceptions -- but if we fold more things into use vX, we need to decide if they all need to be tracked this way.

--
rjbs
Re: use v5.36; use warnings; [ In reply to ]
I like enabling use warnings when you say "use vX", but I also think
it needs to be easy to shut them off even when you want all the other
"use vX" features-- there's an old Randal Schwartz recommendation to
always disable warnings in production code, because new ones may pop
up on perl upgrade.



On 5/28/21, Ricardo Signes <rjbs@semiotic.systems> wrote:
> Porters,
>
> Here's an almost simple one:
>
> I propose that `use v5.36` turns on, in addition to strictures and the
> feature bundle, warnings. Specifically, behaves the same as "use
> warnings".
>
> I'm torn on whether I think it should behave like the "use vX" behavior of
> strict, whereby "no strict; use v5.30" does NOT enable strictures.
> Probably, just for the sake of reducing the number of exceptions -- but if
> we fold more things into use vX, we need to decide if they all need to be
> tracked this way.
>
> --
> rjbs
>
> --
> To unsubscribe from this group and stop receiving emails from it, send an
> email to doom+unsubscribe@kzsu.stanford.edu.
>
Re: use v5.36; use warnings; [ In reply to ]
On Fri, May 28, 2021 at 6:55 PM Ricardo Signes <rjbs@semiotic.systems>
wrote:

> Porters,
>
> Here's an almost simple one:
>
> I propose that use v5.36 turns on, in addition to strictures and the
> feature bundle, warnings. Specifically, behaves the same as "use warnings".
>

Absolutely, +1000, should have been done years ago.


> I'm torn on whether I think it should behave like the "use vX" behavior of
> strict, whereby "no strict; use v5.30" does NOT enable strictures.
> Probably, just for the sake of reducing the number of exceptions -- but if
> we fold more things into use vX, we need to decide if they all need to be
> tracked this way.
>

I think it's a good idea, this was done for a reason, and I can't think of
a reason someone would write this to turn strict/warnings back on rather
than "use strict; use warnings;".

-Dan
Re: use v5.36; use warnings; [ In reply to ]
On Fri, May 28, 2021 at 6:58 PM Joseph Brenner <doomvox@gmail.com> wrote:

> I like enabling use warnings when you say "use vX", but I also think
> it needs to be easy to shut them off even when you want all the other
> "use vX" features-- there's an old Randal Schwartz recommendation to
> always disable warnings in production code, because new ones may pop
> up on perl upgrade.
>

"no warnings" has always been easy. You can also "use feature ':5.36';" if
you want the feature bundle and not the strictures.

-Dan
Re: use v5.36; use warnings; [ In reply to ]
On Fri, 28 May 2021 18:54:23 -0400
"Ricardo Signes" <rjbs@semiotic.systems> wrote:

> Porters,
>
> Here's an almost simple one:
>
> I propose that `use v5.36` turns on, in addition to strictures and
> the feature bundle, warnings. Specifically, behaves the same as "use
> warnings".

Sounds good.

Also reminder that Leon T has already implemented it:

https://github.com/Perl/perl5/pull/18666

Just needs some documentation.

--
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/
Re: use v5.36; use warnings; [ In reply to ]
On Fri, May 28, 2021, at 7:37 PM, Paul "LeoNerd" Evans wrote:
> Also reminder that Leon T has already implemented it:
>
> https://github.com/Perl/perl5/pull/18666
>
> Just needs some documentation.

I haven't built this yet, and can't tonight, but will soon… but the big question for me is what does it do here:
no warnings;
use v5.35.1;
?

--
rjbs
Re: use v5.36; use warnings; [ In reply to ]
On 2021-05-28 6:16 p.m., Ricardo Signes wrote:
> On Fri, May 28, 2021, at 7:37 PM, Paul "LeoNerd" Evans wrote:
>> Also reminder that Leon T has already implemented it:
>>
>> https://github.com/Perl/perl5/pull/18666
>>
>> Just needs some documentation.
>
> I haven't built this yet, and can't tonight, but will soon… but the big question
> for me is what does it do here:
>
> no warnings;
> use v5.35.1;
>
> ?

What I would expect to happen is that the statements are applied in order. So a
"no warnings" above the "use" would have no effect, turning warnings off before
they're turned on again, but having it following the "use" would turn warnings
off after they're turned on. -- Darren Duncan
Re: use v5.36; use warnings; [ In reply to ]
> What I would expect to happen is that the statements are applied in order.

That makes sense if you think abouit it, but it would be pretty easy
mistake to make, I would think. "Why am I still getting warnings
after I explicitly said 'no warnings'?"


On 5/28/21, Darren Duncan <darren@darrenduncan.net> wrote:
> On 2021-05-28 6:16 p.m., Ricardo Signes wrote:
>> On Fri, May 28, 2021, at 7:37 PM, Paul "LeoNerd" Evans wrote:
>>> Also reminder that Leon T has already implemented it:
>>>
>>> https://github.com/Perl/perl5/pull/18666
>>>
>>> Just needs some documentation.
>>
>> I haven't built this yet, and can't tonight, but will soon… but the big
>> question
>> for me is what does it do here:
>>
>> no warnings;
>> use v5.35.1;
>>
>> ?
>
> What I would expect to happen is that the statements are applied in order.
> So a
> "no warnings" above the "use" would have no effect, turning warnings off
> before
> they're turned on again, but having it following the "use" would turn
> warnings
> off after they're turned on. -- Darren Duncan
>
> --
> To unsubscribe from this group and stop receiving emails from it, send an
> email to doom+unsubscribe@kzsu.stanford.edu.
>
>
Re: use v5.36; use warnings; [ In reply to ]
On 2021-05-28 6:32 p.m., Joseph Brenner wrote:
>> What I would expect to happen is that the statements are applied in order.
>
> That makes sense if you think abouit it, but it would be pretty easy
> mistake to make, I would think. "Why am I still getting warnings
> after I explicitly said 'no warnings'?"

It makes more sense when you think of these things being lexical so there can be
multiple instances throughout the code, and then you would expect the statement
to apply just to what follows it until overridden by something else.

Also, anyone savvy enough to know about "no" should be savvy enough to know that
its overriding an explicit "use" further up. Those who aren't savvy and are
just copying boilerplate wouldn't be including any "no".

Also, it would make sense that one would normally make the "use v5.36" etc the
very first thing above any use/no lines, in which case its not an issue.

-- Darren Duncan
Re: use v5.36; use warnings; [ In reply to ]
On Fri, May 28, 2021, at 9:29 PM, Darren Duncan wrote:
> What I would expect to happen is that the statements are applied in order. So a
> "no warnings" above the "use" would have no effect, turning warnings off before
> they're turned on again, but having it following the "use" would turn warnings
> off after they're turned on. -- Darren Duncan

Except that's not how this works with strict, so the question is where we choose to be consistent.

--
rjbs
Re: use v5.36; use warnings; [ In reply to ]
On 2021-05-28 7:12 p.m., Ricardo Signes wrote:
> On Fri, May 28, 2021, at 9:29 PM, Darren Duncan wrote:
>> What I would expect to happen is that the statements are applied in order.  So a
>> "no warnings" above the "use" would have no effect, turning warnings off before
>> they're turned on again, but having it following the "use" would turn warnings
>> off after they're turned on. -- Darren Duncan
>
> Except that's not how this works with strict, so the question is where we choose
> to be consistent.

Here's an idea. If a file contains "use 5.36" or higher, and it contains either
"no warnings" or "no strict" above that use line, then a warning will be emitted
that the "no" should be below the "use" rather than above it. This only happens
for programs with "use 5.36" so older programs won't get extra warnings. The
warnings only appear when someone makes the explicit change to add the "5.36"
and then it will say okay you just made that change now make this change. Also
the use warnings behavior will be dependent on order rather than not like use
strict. -- Darren Duncan
Re: use v5.36; use warnings; [ In reply to ]
On 2021/05/28 15:54, Ricardo Signes wrote:
> I'm torn on whether I think it should behave like the "use vX" behavior of strict, whereby "no strict; use v5.30" does NOT enable strictures.
----
the behavior of "use vX behavior or strict, whereby
'no strict; use v5.30' does NOT enable strictures.

I'm confused, last I heard about 'strict' was that there was an option
in the *configuration* of 5.34 to toggle on 'strict' by default. The
comment
there was:

This setting provides a diagnostic mechanism intended for development
purposes only and is thus undefined by default.

---
So what is this about "use vX" behavior where, when one has "no strict"
before a "use vX" that strictures are NOT enabled? Specifically, does
that imply that a "use vX" without "no strict before it" DOES enable
strictures?

That seems to be a large jump ahead of defining a developmental
configuration option to default them to "on".

In addition to what seems to be "defaulting to strict" under "use Vx"
in "[some?]" version of perl you are asking if warnings should be on as
well?

If strictures are on by default, does that mean they are fatal as they
are now?

OB semantics:
how would 'use vX' know there was a "no strict" before the use
statement, vs. there being no "use strict"?

Before commenting on anything else, I hope the above is clarified...
Re: use v5.36; use warnings; [ In reply to ]
On Fri, May 28, 2021, at 10:49 PM, L A Walsh wrote:
> Before commenting on anything else, I hope the above is clarified...

I'm afraid I had a really hard time understanding your post, so I'm going to try the old strategy of stating all the facts that might be relevant.

1?? strict is not on by default in any version of perl5 and this is not changing.

Example code:

perl -e '$x = 1'

2?? since perl v5.12.0, "use v5.12.0" has enabled strict, *unless it was explicitly disabled first*

Example code:

perl -e 'use v5.12.0; $x = 1'

perl -e 'no strict; use v5.12.0; $x = 1'

In other words, "use vX" turns on strict if X is at least 5.12.0, unless it was preceded by "no strict".

3?? I am proposing that putting "use v5.36.0" (or later) in your program will *also* enable warnings

…and then the question is: will "use v5.36.0" have the same quirk of not turning on warnings if it was preceded by "no warnings"?

--
rjbs
Re: use v5.36; use warnings; [ In reply to ]
On 2021-05-29 7:11 a.m., Ricardo Signes wrote:
> In other words, "use vX" turns on strict if X is at least 5.12.0, unless it was
> preceded by "no strict".
>
> 3?? I am proposing that putting "use v5.36.0" (or later) in your program will
> *also* enable warnings
>
> …and then the question is: will "use v5.36.0" have the same quirk of not turning
> on warnings if it was preceded by "no warnings"?

To answer your question, I am proposing that the behaviour of "no strict" prior
to the "use" is a mistake not to be repeated, and that reasonable actions are
taken to mitigate that mistake.

So "no warnings" will NOT behave the same as "no strict", and rather "no
warnings" will only have an effect if it FOLLOWS something that turns warnings on.

As for the inconsistency this would raise with "no strict", I propose the
solution is simply to emit a warning in any program that has a "no strict" prior
to a "use 5.36" and the warning would say the statements should be reordered so
the "no strict" appears afterwards.

That solution means actual programs are consistent in appearance and behavior.
While "no strict" would still suppress strict if used first, anyone attempting
to use it would be warned to stop doing so, and so that behavior becomes unused.

-- Darren Duncan
Re: use v5.36; use warnings; [ In reply to ]
Op 30-05-2021 om 02:43 schreef Darren Duncan:
> As for the inconsistency this would raise with "no strict", I propose
> the solution is simply to emit a warning in any program that has a "no
> strict" prior to a "use 5.36" and the warning would say the statements
> should be reordered so the "no strict" appears afterwards.
>
> That solution means actual programs are consistent in appearance and
> behavior. While "no strict" would still suppress strict if used first,
> anyone attempting to use it would be warned to stop doing so, and so
> that behavior becomes unused.
>

I would say this is the most sensible solution.


M4
Re: use v5.36; use warnings; [ In reply to ]
I support enabling `warnings` with `use v5.36` 1000%. I'm surprised we
didn't already do it. I only see it as a net positive.

I don't know if the `no warnings; use v5.36` is worth the effort? I
can't think of a real world scenario where you'd want one without the
other. And if you did you can enable features one by one. If it's easy
then we should do it... but I wouldn't want to spend too much time on it.

Please make this happen.

- Scott

On 5/28/21 3:54 PM, Ricardo Signes wrote:
> Porters,
>
> Here's an almost simple one:
>
> I propose that |use v5.36| turns on, in addition to strictures and the
> feature bundle, warnings.  Specifically, behaves the same as "use
> warnings".
>
> I'm torn on whether I think it should behave like the "use vX"
> behavior of strict, whereby "no strict; use v5.30" does NOT enable
> strictures.  Probably, just for the sake of reducing the number of
> exceptions -- but if we fold more things into use vX, we need to
> decide if they all need to be tracked this way.
>
> --
> rjbs
Re: use v5.36; use warnings; [ In reply to ]
On 2021/05/29 07:11, Ricardo Signes wrote:
> On Fri, May 28, 2021, at 10:49 PM, L A Walsh wrote:
>
>> Before commenting on anything else, I hope the above is clarified...
>>
> I'm afraid I had a really hard time understanding your post, so I'm going to try the old strategy of stating all the facts that might be relevant.
>
> 1?? strict is not on by default in any version of perl5 and this is not changing.
> Example code:
> perl -e '$x = 1'
> 2?? since perl v5.12.0, "use v5.12.0" has enabled strict, *unless it was explicitly disabled first*
>

---
This clarifies my misunderstanding.

I've virtually never used:
'use v5.12.0' #(or any other version) *without*

prior lines (or immediately after):
use warnings;use strict;

So I wasn't aware that use strict was already toggled on before such.


I find it a bit odd that having the use-version after
the no-strict wouldn't toggle it back on if
'use strict' was advertised being part of the 5.12 bundle.

I'm not sure I understand why that was done that way, since it would
seem to violate normal perl semantics.


I'm assuming that the order:

use v5.12.0;
no strict;

Would also result in 'strict being off'?
Is it also the case that a "use version" statement, for any version
>5.12.0, also toggles on strict, but is similarly silenced by a 'no
strict' on either side of the 'use'?
Re: use v5.36; use warnings; [ In reply to ]
On Sat, May 29, 2021 at 10:11:34AM -0400, Ricardo Signes wrote:

> In other words, "use vX" turns on strict if X is at least 5.12.0, unless it was preceded by "no strict".
>
> 3?????? I am proposing that putting "use v5.36.0" (or later) in your program will *also* enable warnings
>
> ???and then the question is: will "use v5.36.0" have the same quirk of not turning on warnings if it was preceded by "no warnings"?

I'd prefer "use vX" to *ignore* the current strictness/warningness and
always turn 'em on, but I realise it's too late to change now.

So I would suggest that if we're going to have confusing behaviour - ie
"use vX" sometimes turns something on, sometimes not - then we should
have *consistent* confusing behaviour.

--
David Cantrell | Cake Smuggler Extraordinaire

If you can't imagine how I do something, it's
because I have a better imagination than you
Re: use v5.36; use warnings; [ In reply to ]
> In other words, "use vX" turns on strict if X is at least 5.12.0, unless it was preceded by "no strict".

TIL ...

Some questions / observations:

1. What happens if "use vX" is preceded by "no strict 'refs'" – do you get strict vars and subs?
2. Is this documented anywhere (other than the perldelta that introduced it, which was presumably 5.12?
3. Seems like this should be mentioned in the doc for strict (that was the first place I looked)
4. If the answer to #1 is "Yes", then the doc for `use` should probably be updated too.

This behaviour seems surprising.

I like Darren’s suggestion, that "no warnings" before "use v5.36" should warn, but give 5.36’s warnings behaviour.

Which means that I think that "no strict" before "use vN" should warn and give "use vN"’s behaviour. But if we change that, there should be 2 releases where you get the warning but the current behaviour, and then we flip.

Neil
Re: use v5.36; use warnings; [ In reply to ]
On Sun, Jun 6, 2021, at 7:09 PM, Neil Bowers wrote:
>> In other words, "use vX" turns on strict if X is at least 5.12.0, unless it was preceded by "no strict".
> 1. What happens if "use vX" is preceded by "no strict 'refs'" – do you get strict vars and subs?
> 2. Is this documented anywhere (other than the perldelta that introduced it, which was presumably 5.12?
> 3. Seems like this should be mentioned in the doc for strict (that was the first place I looked)
> 4. If the answer to #1 is "Yes", then the doc for `use` should probably be updated too.

I'm not sure what you mean by "this" in "Is this documented." The enabling-strict behavior of "use v5.12" happens when you "use", and so is documented under "use". Adding a cross-reference in strict is perfectly reasonable.

"use VERSION" also lexically enables all features available in
the requested version as defined by the feature pragma,
disabling any features not in the requested version's feature
bundle. See feature. Similarly, if the specified Perl version is
greater than or equal to 5.12.0, strictures are enabled
lexically as with "use strict". Any explicit use of "use strict"
or "no strict" overrides "use VERSION", even if it comes before
it. Later use of "use VERSION" will override all behavior of a
previous "use VERSION", possibly removing the "strict" and
"feature" added by "use VERSION". "use VERSION" does not load
the feature.pm or strict.pm files.

So, "overrides" is perhaps vague, but easy to test:

~$ perl -e 'no strict; use v5.12.0; $x = 1'
(no error)

~$ perl -e 'no strict "refs"; use v5.12.0; $x = 1'
Global symbol "$x" requires explicit package name (did you forget to declare "my $x"?) at -e line 1.
Execution of -e aborted due to compilation errors.

~$ perl -e 'no strict "vars"; use v5.12.0; $x = 1'
(no error)

> This behaviour seems surprising.

Here's one post about it from 2011: https://markmail.org/message/jvktz6zayls4okez

…but that mostly defers to advice provided by Father C. in an earlier post. Also, note that this discussion is late 2011, which is over a year after v5.12.0 shipped with "enables strict." So when did this change? It changed in v5.16.0, noted as follows in perl5160delta:

"use *VERSION*"
As of this release, version declarations like "use v5.16" now disable
all features before enabling the new feature bundle. This means that the
following holds true:

use 5.016;
# only 5.16 features enabled here
use 5.014;
# only 5.14 features enabled here (not 5.16)

"use v5.12" and higher continue to enable strict, but explicit "use
strict" and "no strict" now override the version declaration, even when
they come first:

no strict;
use 5.012;
# no strict here

This was changed in b50b20584a1 <https://github.com/Perl/perl5/commit/b50b20584a1>. It took me ages to track down the original thread to which I made reference, but I finally did it: https://markmail.org/message/homuy7tspk3sgkag

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:
* imagine that "use v5.34" turns on "switch", but "use v5.36" does not
* your program says: { use v5.34; use v5.36; EXPR }
* is switch enabled at EXPR?
* the goal was to make every "use" statement configure everything to its specification, not to layer atop the previous environment
…at which point somebody (Eric Brine) said: If we apply that logic to the way that use v5.12.0 affects strict, then saying use v5.10.0 should turn strict back off, and what about people who have already written this program:
use strict;
use warnings;
use 5.010;

This left us with the question of how to not break that code, but be consistent, which got us to where we are today.

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.

--
rjbs
Re: use v5.36; use warnings; [ In reply to ]
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
Re: use v5.36; use warnings; [ In reply to ]
On Fri, Jun 18, 2021 at 3:26 PM Ricardo Signes <perl.p5p@rjbs.manxome.org>
wrote:

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

This sounds reasonable to me. We should *not* retroactively make it turn
off strict or warnings on older versions, but unconditionally enabling it
on the new versions would be more intuitive.

-Dan
Re: use v5.36; use warnings; [ In reply to ]
On Fri, Jun 18, 2021 at 4:23 PM Dan Book <grinnz@gmail.com> wrote:

>
> This sounds reasonable to me. We should *not* retroactively make it turn
> off strict or warnings on older versions, but unconditionally enabling it
> on the new versions would be more intuitive.
>

To clarify: I think the goal of making "use strict; use v5.10;" keep strict
on was correct, and we should keep supporting that, and do the same for
warnings. But "no strict; use v5.12;" should (after appropriate
deprecation) enable strict.

-Dan
Re: use v5.36; use warnings; [ In reply to ]
On Fri, 18 Jun 2021 15:24:41 -0400
"Ricardo Signes" <perl.p5p@rjbs.manxome.org> wrote:

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

That all sounds quite good, yes.

It's also a much simpler mental model for everyone - each declaration
might fiddle with things, but they all do so in written order.
`use VERSION` might twiddle a lot of things that a later more specific
`no strict 'this'; no warnings 'that';` turns off again.

It also suggests a good general rule - put the `use VERSION` first
thing in the file, then the other use/no pragmata after it.

That's what I in fact already do. :)

--
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk | https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/
Re: use v5.36; use warnings; [ In reply to ]
2021-6-19 5:27 Dan Book <grinnz@gmail.com> wrote:

> On Fri, Jun 18, 2021 at 4:23 PM Dan Book <grinnz@gmail.com> wrote:
>
>>
>> This sounds reasonable to me. We should *not* retroactively make it turn
>> off strict or warnings on older versions, but unconditionally enabling it
>> on the new versions would be more intuitive.
>>
>
> To clarify: I think the goal of making "use strict; use v5.10;" keep
> strict on was correct, and we should keep supporting that, and do the same
> for warnings. But "no strict; use v5.12;" should (after appropriate
> deprecation) enable strict.
>
> -Dan
>

Is it possible to improve use vx behavior in the future keeping backwards
compatibility of past use vx behavior?

1 2  View All