On Oct 30, 2011, at 10:59 PM, Father Chrysostomos wrote:
> Aristotle wrote:
>> What you really want to happen is for provenance to be remembered. In
>> case of
>>
>> use strict;
>> use 5.010;
>>
>> you want strictures to be enabled because they were enabled explicitly.
>> But in case of
>>
>> use 5.012;
>> use 5.010;
>>
>> you want them disabled, because they were only implicitly enabled by way
>> of a version feature bundle.
>>
>> I’d also argue by the same token that
>>
>> use feature 'unicode_strings';
>> no 5.014;
>>
>> should leave `unicode_strings` enabled.
>
> Unfortunately, no 5.014 already means something else.
>
> $ perl5.15.4 -M-5.014
> Perls since v5.14.0 too modern--this is v5.15.4, stopped.
> BEGIN failed--compilation aborted.
>
> I think making
>
> use feature 'unicode_strings';
> use 5.010;
>
> leave the feature enabled might be going a bit to far. It makes it
> harder to document. If we say that use-version enables the feature
> bundle for that version, then we have to go through contortions to
> explain that it doesn't really.
Actually, it would work quite well. See below.
>
>>
>>
>> We don’t have a mechanism to do that.
>>
>> I’m not sure how feasible it would be to retrofit.
>>
>> Though on reflection it might even be very easy, since I think only
>> feature.pm needs some extra code – if the enabling of strictures is
>> retroactively re-cast as a feature, it might even not require touching
>> anything else. I’m not sure.
>
> strict would have to be remembered in two places. "use strict" would
> have to turn on strict the usual way *and* turn off the strict
> features, so that feature.pm knows not to disable strict. That is
> quite doable.
>
> If $[ is to be disabled under 5.16, then I think we do need something
> like that. $[ will become a part of the 5.14 bundle (and lower
> versions). "use v5.16" will disable it, as not being part of the
> 5.16 bundle.
>
> Leon Timmermans suggested that strictures become fatal warnings. I
> could never figure out a way to stop "no warnings" from turning off
> strict, though. Maybe it could be based on this somehow.
That plan (my idea) cannot work, as ‘use feature ":5.12"’ would then enable strict. I think the actual solution is closer to what you (Aristotle) wrote above: Have version declarations use their own hints, and let explicit ‘use foo’ declarations override the version-specific defaults.
Under this scheme, we can reintroduce legacy.pm, for things like $[. The features it enables will be enabled by default, due to version hints, so it will not usually be loaded. But under 5.16 mode, one can say ‘use legacy "array_base"’.
We will still have the inconsistency that an explicit ‘no strict’ or ‘no feature’ will not stop version declarations from re-enabling them, while an explicit ‘use’ *will* stop version declarations from *dis*abling them. I think we can live with that.
So under my proposal
use feature ":5.12";
use 5.010;
would enable the 5.12 features, because explicit feature requests override version declarations. (The 5.010 declaration is actually redundant there.) On the other hand
use 5.012;
use 5.010;
will only enable 5.10 features, because version declarations override each other (the last one wins).
use strict;
use 5.012;
use 5.010;
will enable 5.10 features and strict mode.
If no one objects shortly, I’ll go ahead and do this, as it is currently blocking the disabling of $[ in 5.16 mode.
Thread Previous
|
Thread Next