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:
Ævar Arnfjörð Bjarmason
Date:
August 1, 2010 13:01
Subject:
Re: qr stringification: why are xism always present? I'm worried about backward compatibility
Message ID:
AANLkTi=z9nPF3X53F9HLjY2PzQRkuAWLPhwp1=A9BHb9@mail.gmail.com
On Sun, Aug 1, 2010 at 19:44, karl williamson <public@khwilliamson.com> wrote:

> I still don't understand.  I had considered interpolation, and it still
> seems to me that the absence of a modifier means use the underlying default
> for the duration of that interpolation, no matter what the outer regex says.
>  I don't see a flaw in that thinking.

It's not an issue if you have a regexp object. But consider this:

    $ perl -E 'my $s = "foo"; my $o = qr/foo/; my $so = "$o"; my $n =
qr/ $s ${o} blah ${so} /i; say $n'
    (?i-xsm: foo (?-xism:foo) blah (?-xism:foo) )

Even if we didn't dump the default modifiers we could detect the "$o"
case since it's a regexp object, but we wouldn't detect "$so" since
it's a stringified "$o".

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