develooper Front page | perl.perl5.porters | Postings from December 2011

Re: what's "use VERSION" all about?

Thread Previous | Thread Next
From:
Father Chrysostomos
Date:
December 4, 2011 13:32
Subject:
Re: what's "use VERSION" all about?
Message ID:
F2F617C0-8D27-45CB-B2F4-696E2FE3E2EA@cpan.org

On Nov 29, 2011, at 8:45 AM, Jesse Luehrs wrote:

> On Tue, Nov 29, 2011 at 04:36:37PM -0000, Father Chrysostomos wrote:
>> Ricardo Signes wrote:
>>>   no strict;
>>>    use 5.12.0;
>>>    # strictures are still OFF here
>>> 
>>> I think we're stuck with that, and that's all there is to it.
>> 
>> Should the same apply to feature.pm, too?
>> 
>>    use feature "current_sub";
>>    use 5.10.0;
>>    # __SUB__ works here, because it was explicitly requested
>> 
>> So version declarations will simply set the default the strict.pm and
>> feature.pm will modify.
> 
> I would say no - version declarations and feature declarations should be
> equivalent, with strict.pm being a special case

But when warnings are enabled by default, do we add another special case? Would that special case apply to all pragmata that we want to become defaults (version-specific defaults, that is, not default defaults)?

> (although I do think
> that adding a separate 'strict' feature which is enabled by 5.12 and
> above would be a good thing -

I liked that idea when it was proposed a while back.  But it can’t work because ‘use feature ":5.12"’ doesn’t currently enable strict.  Also, would it not have to be three strict features?

What happens when warnings are enabled by default?  Do all version categories become sub-features?  Do we have to push all existing pragmata into feature.pm that we make into version-specific defaults?

> having "use VERSION" mean almost the same
> thing as "require VERSION; feature->import(':VERSION')", but not quite,
> is also confusing and hard to document).

I don’t doubt that, but it has already been the case since 5.12.  As of 5.12, version declarations are already picking and choosing between different pragmata (feature and strict), putting feature.pm and strict.pm on the same level, in a decidedly different category from ‘use 5.xx’ itself.

I thought that with my suggestion I was providing the easiest way out.  The new explanation becomes: Version declarations set the defaults; explicit pragmata (use strict/feature) override the defaults, whether they come before or after the version declaration.

Isn’t that simple enough?


> Trying to make it more
> complicated than this feels like it's just going to make it more
> confusing to understand.
> 
>> I do not mind having feature features added retroactively to existing
>> feature sets, but would you be willing to consider reintroducing
>> legacy.pm as an alternative?  I think it simplifies things both in
>> terms of implementation and conceptually:
>> 
>>    no legacy 'inc_operator';
>> 
>> On the other hand it might complicate things in future releases when
>> we cannot decide whether a new feature is actually the disabling
>> of a bug (e.g., feature "unicode_strings" is actually no legacy
>> "unicode_bug").
> 
> How does it simplify things at all? I don't really see how the
> implementation would be anything other than identical, and having a
> single interface rather than two seems simpler conceptually to me.

I withdraw the legacy.pm proposal.


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