develooper Front page | perl.perl5.porters | Postings from December 2009

Re: PATCH: partial [perl #58182]: regex case-sensitive matching now utf8ness independent

Thread Previous | Thread Next
From:
demerphq
Date:
December 10, 2009 00:43
Subject:
Re: PATCH: partial [perl #58182]: regex case-sensitive matching now utf8ness independent
Message ID:
9b18b3110912100043x16ebd036t3db0f6acea39888f@mail.gmail.com
2009/12/10 karl williamson <public@khwilliamson.com>:
> demerphq wrote:
>> I have two minor objections, but i dont think they need be seen as
>> roadblocks.
>>
>> First, the problem of qr// raises its head. You construct a pattern
>> one context with your new pragma in effect, and then embed it in
>> another pattern somewhere else and the magicness of the pattern is
>> lost. This is the same problem as with use locale, and personally
>> something I think breaks the general modern model of patterns. However
>> it is better than nothing and modifiers can be leveraged on top of
>> your patch so that is fine IMO.
>
> I'm not sure I follow this.  I think what you're saying is that the original
> pattern is decompiled or thrown away and then recompiled under the new
> scheme?

Yes. Essentially that is how embedding a qr// object into another pattern works.

Basically its like a C include. When you do:

my $qr1= qr/this is a pattern/;
my $qr2= qr/this is a pattern containing another pattern $qr1/;

the *source* of $qr1 is embedded in $qr2, not the opcodes. So any
behaviour that is controlled that by pragmatta and not by in-regex
modifiers will be lost. This is why the /msix modifiers have (?msix:
... ) forms.

>>
>> Second, and really this is just another facet of the original problem
>> is that people now need to modify existing code to preserve the
>> existing semantics. If this was controlled by modifier then this
>> wouldnt be necessary as we would just make the default modifier behave
>> as in 5.8.x, also if really necessary we could bifurcate the POSIX
>> stuff into multiple opcodes (old/new behaviour) and resolve any
>> objections to fixing the POSIX opcodes.
>
> One should be able to change the default modifier, I would hope.

Yes, i was thinking that a good plan would be to just define a generic
interface for specifying default modifiers. The people that like to
follow PBP recommendation of using /msx always can use the pragma.

Yves

-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

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