develooper Front page | perl.perl5.porters | Postings from February 2003

Re: [perl #20683] [fix] /(??{$x})/ ignore any changes made to $x

Thread Previous | Thread Next
February 22, 2003 19:32
Re: [perl #20683] [fix] /(??{$x})/ ignore any changes made to $x
Message ID:
In article <20030223004840.GA1442@ratsnest.hole>,
	Enache Adrian <> writes:
> On Sat, Feb 22, 2003 at 09:11:03PM +0000, Ton Hospel wrote:
>> This seems a case where the problem can be solved by simply dropping
>> this optimization. If the value wasn't supposed to change all the 
>> time, the user would almost certainly have written s/$p// instead of
>> s/(??{$p})//, so i think this optimization is not worth it (ok, someone
>> might do it to set $^R and $^N)
> IMHO that optimization is worth keeping in.
> (??{ ... }) 's may return (by different paths!) complicated regular
> expressions or long chunks of text.
> Caching them dramatically improves the performance.
I don't get it.
- if the value isn't going to change (much), why did the user use a (??{$p}) ?
  What is the scenario in which you expect the cache to be hit ?
- why is the r-magic not invalidated when the variable gets assigned ?

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About