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

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

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
August 19, 2010 08:06
Subject:
Re: qr stringification: why are xism always present? I'm worried about backward compatibility
Message ID:
20100819150552.GG48531@plum.flirble.org
On Thu, Aug 19, 2010 at 04:58:48PM +0200, Abigail wrote:
> On Thu, Aug 19, 2010 at 03:42:27PM +0100, Zefram wrote:
> > Abigail wrote:
> > >                                 '(?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".

[I'll use (?~, but the current patch proposes (?^]

(?~-xm:) means "defaults, and then turn off x and m. So it's a tautology.
Therefore I'd argue that use of a - in a (?~ should be a syntax error.

No options can default to on. If they are on by default, then by the same
reasoning, you can't tell me what qr/PATTERN/ is going to do, without
asking me the perl version.

With the axiom than "all options default to off, and always will" then I
believe there is no regexp that can be written with the new syntax that is
ambiguous.

Nicholas Clark

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