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

Re: use 5.XXXYYY (was Re: ...st_birthtime...)

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
February 28, 2009 07:25
Subject:
Re: use 5.XXXYYY (was Re: ...st_birthtime...)
Message ID:
b77c1dce0902280725n768fbfb1s7049fc49cf38a39c@mail.gmail.com
2009/2/28 David Golden <xdaveg@gmail.com>:
> On Sat, Feb 28, 2009 at 12:53 AM, Abigail <abigail@abigail.be> wrote:
>> No, please, let's not. Let's keep the meaning of "use 5.X" reasonable
>> safe. It should mean "hey, compiler, I promise you, I'm not using any
>> of the new keywords as user subs". In the vast majority of the cases,
>> leaving off 'use 5.X' should either make no difference (if no feature
>> is used), or result in a compile time error (if a new feature is used).
>>
>> It shouldn't mean the program will behave differently in a subtle, and
>> hard to debug, way.
>
> This is worth a broader debate, I think.  I'd much rather see "use
> 5.XXXYYY" to mean "hey, compiler, I promise you that I expect a
> certain default behavior -- you don't need to worry about being
> backwards compatible for code that might have been written a decade
> ago for 5.004"

For ages, "use 5.XXXXYYY" has mean "I'm going to use features of
behaviours that are only provided or tested from this perl version
onwards". It has never meant "change the behaviour of an existing
feature into a more useful albeit incompatible one". Changing behaviours
has been traditionnally the domain of explicit pragmas. Or, of
incompatible changes. (Like the suppression of pseudo-hashes)

> It's a logical extension of "use 5.010" also having the effect of "use
> feature ':5.10'".  It just means that 'feature' is used not only for
> new syntax but for semantic changes or extensions to existing syntax.

No, we don't need any pragma or compiler hint to extend existing
syntax, since it would anyway fail to compile on previous versions.
"my $_" or "//" don't need "use 5.010" to work. "feature" has been
used only for incompatible syntax changes, to prevent old code from
being misinterpreted by perl -- exactly like "use.5.006" was used.

> feature could also be used for automatic enabling of other pragmata --
> or that could be attached to the "use 5.XXXYY".  I.e. if there were a
> 'pragmas.pm' that enabled/disabled pragma bundles the same way that
> feature enables/disables feature bundles, then it would work like this
>
>    use 5.XXXYYY;
>    # also does: use pragmas ':5.10';
>
> Then "use pragmas ':5.12'" could, for example, do "use strict; use
> warnings: use feature ':5.12'" and so on.

OK, but I don't think such a pragmas.pm should be in the core. It
doesn't need to.

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