develooper Front page | perl.perl5.porters | Postings from January 2009

"use legacy" vs "use feature" (was: RFC: Consolidated proposalfor octals like \400 in strings.)

Thread Previous | Thread Next
From:
karl williamson
Date:
January 11, 2009 12:04
Subject:
"use legacy" vs "use feature" (was: RFC: Consolidated proposalfor octals like \400 in strings.)
Message ID:
496A50CE.1000700@khwilliamson.com
Rafael Garcia-Suarez wrote:
> 2008/12/6 Abigail <abigail@abigail.be>:
>> On Sat, Dec 06, 2008 at 12:55:58AM +0000, Ben Morrow wrote:
>>>
>>> If these changes were made 'feature's instead, all people wanting new
>>> behaviour would have to do is insert
>>>
>>>     use 5.012;
>>
>> We went over this some time ago as well. Then it was agreed upon
>> that 'use 5.XXX' should not mean anything more than "hey, compiler,
>> my code doesn't use any identifiers that may clash with new keywords,
>> so feel free to consider them keywords". It most definitely shouldn't
>> change the meaning of constructs.
> 
> I agree. See feature's manpage:
> 
> =head1 NAME
> 
> feature - Perl pragma to enable new syntactic features
> 
> =head1 DESCRIPTION
> 
> It is usually impossible to add new syntax to Perl without breaking
> some existing programs. This pragma provides a way to minimize that
> risk. New syntactic constructs can be enabled by C<use feature 'foo'>,
> and will be parsed only when the appropriate feature pragma is in
> scope.
> 
> =cut
> 
> So it's explicitly stated that feature.pm is for new syntax.
> That means that we could use it to enable \o{...} (although I don't
> see a necessity), but not for changing existing syntax.
> 
> 
I have been thinking about this some more, and wonder if the definition 
of "use feature" could change so that it encompasses more than just 
syntax, but other things like semantic changes we think may break 
existing code.  And that some things that this enables may change in the 
future to be enabled by default, and one has to say "no feature 'xxx'" 
or "no feature ':5.12' to keep the old behavior.

Then we wouldn't need a legacy pragma, but feature would suffice for 
both sorts of things.  We could then at some point, for example, make 
"say" enabled by default.

But it does mean expanding the meaning of 'feature'.  What do you think?

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