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

Re: Perl 5.16 and Beyond.

Thread Previous | Thread Next
From:
H.Merijn Brand
Date:
September 13, 2011 05:11
Subject:
Re: Perl 5.16 and Beyond.
Message ID:
20110913141134.2b19feb9@pc09.procura.nl
On Tue, 13 Sep 2011 13:48:41 +0200, Abigail <abigail@abigail.be> wrote:

> On Mon, Sep 12, 2011 at 12:28:47PM -0400, Jesse Vincent wrote:
> > 
> > 	- New versions of Perl 5 should not break your existing software
> > 	- Backward compatibility must not stop Perl 5 from evolving
> > 	- From 'use v5.16' forward, Perl should start treating 'use v5.x'
> >         statements as "try to give me a Perl that looks like v5.x" rather
> >         than "give me at least v5.x"
> > 	- We're awesome at modules. Where possible, we should be
> >         modularizing core features.
> > 
> 
> In general, yes, yes, yes. (I've seen Jesse's talk twice, and we've
> talked about it as well, so it isn't all new to me).
> 
> I do, however, like to make a note about the new meaning of "v5.x". At
> first, my reaction was "yes, that's very logical, it's got to be better
> than what we have now".
> 
> Then I wrote a module that does this:
> 
>     use 5.006;
>     sub match_all {
>         my ($subject, $pattern) = @_;
> 
>         our @matches = ();
> 
>         my $pat = ref $pattern ? $pattern : qr /$pattern/;
> 
>         use re 'eval';
> 
>         $subject =~
>             /(?-x:$pat)
>              (?{ push @matches =>
>                  [map {substr $subject, $- [$_], $+ [$_] - $- [$_]} 1 .. $#-] })
>              (*FAIL)
>             /x;
> 
>         wantarray ? @matches : [@matches];  # Must copy.
>     }
> 
> 
> It takes a pattern with captures, and returns every possible match.
> 
> It has "use 5.006;" there. It really means, "give me 5.006 or newer". 
> 
> In Jesse's scheme, from 5.16 onwards, this is going to mean "5.14
> semantics".  But if this is run on 5.20, it shouldn't restrict itself
> to patterns with 5.14 semantics. If it's run on 5.20, it should also
> work on regexp constructs that were introduced in 5.18.
> 
> 
> 
> So, the deeper issue here is if "use 5.x" is going to mean "run with
> 5.x" semantics, you may end up with different parts of a program that
> use different semantics for the same code, and interpret the same data
> differently - just because one module uses "5.x" and the other "5.y".
> (For instance, do we really want a program to use two modules, where
> one module uses Unicode X.0 semantics, and another module Unicode
> Y.0 semantics, possibly giving different results on "lc $str" for the
> same $str?)
> 
> 
> Now, this doesn't mean I'm against changing the meaning of "use 5.x". In
> general, I think it's a good idea, and it will help Perl moving forwards.
> But I think there are some issues that need to be addressed. And for
> which I, at this moment, don't have a solution for.

I agree with your sentiment.

I suggested

  use ge5.008004;	# use any perl version >= 5.8.4
  use v5.10.1-5.12.3;	# use >= 5.10.1 but <= 5.12.3

and alike.

I have always used 'use 5.008004;' with the *intention* to mean 5.8.4
*OR NEWER*, as 5.8.4 fixed a bug that would crash my script on older
versions. I do not want to update that script if 5.38.2 introduces some
conflicting syntax: I'll fix the script to be compatible and *still*
require 5.8.4 as a minimum  version.

-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.14 and porting perl5.15.x on HP-UX 10.20, 11.00,
11.11, 11.23 and 11.31, OpenSuSE 10.1, 11.0 .. 11.4 and AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/

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