develooper Front page | perl.perl5.porters | Postings from August 2010

Re: RFC: New regex modifier flags

Thread Previous | Thread Next
From:
H.Merijn Brand
Date:
August 6, 2010 06:04
Subject:
Re: RFC: New regex modifier flags
Message ID:
20100806150358.7e614e15@pc09.procura.nl
On Fri, 6 Aug 2010 08:14:02 -0400, David Golden <xdaveg@gmail.com>
wrote:

> On Fri, Aug 6, 2010 at 7:36 AM, karl williamson <public@khwilliamson.com> wrote:
> > I did an analysis of this, and it turns out that the only ambiguous case is
> > 's/foo/bar/le'.  It seems like overkill for this to invent a new temporary
> > pragma, and forbid all the new modifiers as suffixes, when there is no
> > ambiguity at all outside of substitutions, and no ambiguity  using
> > substitutions except for one  combination out of all those possible.  Why
> > can't we just say in the pods and warning message that '/le'  must be
> > written as '/el' in 5.14?
> 
> Help me understand what you mean by ambiguous. If there is really only
> one case, then great!
> 
> But hypothetically, what would s/foo/bar/elt1 do?  Would the "l" parse
> as a modifier or would it parse as bar of "lt"?
> 
> Here's a stupid, but legal example:
> 
>   $ perl -wE '$_=<>; sub bar { "bar" }; if ( s/foo/bar/elt 1 ) { say
> "not done" }'

And mind you that some module might add those flags dynamically. I know
abigail does some funky stuff, but I bet others do to. Then an eval of
code with a generated regex where the l got inserted just before the e
will suddenly fail.

FWIW I have no strong opinions here, just pointing to possible places
of hurt.

-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.12 and porting perl5.13.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, OpenSuSE 10.3, 11.0, and 11.1, 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