develooper Front page | perl.perl5.porters | Postings from September 2014

Re: Versioned 'strict'

Thread Previous | Thread Next
From:
Abigail
Date:
September 12, 2014 11:02
Subject:
Re: Versioned 'strict'
Message ID:
20140912110155.GA24843@almanda.fritz.box
On Fri, Sep 12, 2014 at 09:55:17AM +0100, Paul LeoNerd Evans wrote:
> On Fri, 12 Sep 2014 08:04:56 +0200
> Rafael Garcia-Suarez <rgs@consttype.org> wrote:
> 
> > On 11 September 2014 20:28, Paul "LeoNerd" Evans
> > <leonerd@leonerd.org.uk> wrote:
> > > I live in eternal hope that one day, one day, we'll get around to
> > > implementing in core some more strictness flags than the current
> > > ancient set of three (vars, subs, refs).[*]
> > 
> > If I remember correctly, this idea was shot down forever for
> > backwards-compatibility
> > reasons: "use strict" with a new flag is a compile-time error
> > currently, so that would
> > require to specify a minimum version anyway.
> 
> I'm not sure I see how this is any different to, say, "use feature".
> 
> "use feature" was added in 5.10, meaning if your program starts
> 
>   use feature 'say';
> 
> it will crash on 5.8. That was deemed acceptable.
> 
> Right now /all/ I am proposing is that strict.pm accept and silently
> ignore a :NUMBER tag, where that number is 5.22 or earlier. This means
> you can write
> 
>   use strict :5.22;
> 
> Yes I know it will crash on a pre-5.21.{mumble} perl in much the same
> way that "use feature" will crash pre-5.10. That's OK.


You can just write:

    use 5.022;
    use strict ':5.22';

and execution will be terminated with a suitable error message; any 
pre-5.22 perl will not even get to compile the "use strict ':5.22';" line.



Abigail

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