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

Re: qr stringification: why are xism always present? I'm worriedabout backward compatibility

Thread Previous | Thread Next
From:
Abigail
Date:
August 19, 2010 07:57
Subject:
Re: qr stringification: why are xism always present? I'm worriedabout backward compatibility
Message ID:
20100819145848.GC22963@almanda
On Thu, Aug 19, 2010 at 03:42:27PM +0100, Zefram wrote:
> Abigail wrote:
> >written code that actually scans for (?xism:) constructs and modifies
> >them. Such code would break if (?xism:) is going to be replaced with (?~:).
> 
> Without (?^:) it's liable to break whenever new flags are added.

Only if you're actually going to change the meaning of modifiers. I parsed
for /\(\?([a-z]*)(-?)([a-z]*):/i, knowing that if modifiers were to be added,
it would be ASCII letters. And then inspect and mangle $1 & $3.

> >                                 '(?si-xm:)' tells me exactly what's
> >enabled, and what's disabled, regardless of the Perl version.
> 
> No, it doesn't.  It doesn't tell you whether the /p flag is enabled.

It does. It tells me that pattern following the : neither enables, nor
disables /p. Whether /p is in effect is inherited from the enclosing
pattern.

I can take '(?si-xm:PATTERN)', and know what it does by itself. Regardless
of Perl version. If someone comes to me and ask what '(?si-xm:PATTERN)'
means, I can explain it to him. If he comes with '(?~-xm:PATTERN)', I'll
have to reply "well, that depends on the version of Perl you're running".


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