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

Re: [perl #68816] RE match variable scope

Thread Previous
Ian Goodacre
August 27, 2009 15:34
Re: [perl #68816] RE match variable scope
Message ID:
demerphq wrote:
> 2009/8/27 (via RT) <>:
>> If there is a reason not to change this behavior then the behavior and
>> the reason for it should be prominently documented.
> Leaving aside the technicalities involved, would you feel that this is
> a bad choice to take?
> In other words, given that "fixing" this behaviour would probably
> break /something/, yet clearly it is not in agreement wit the
> documentation (i think because of optimisations) do you see any
> serious problem with leaving it?
> Im curious as to how people view the trade offs involved here.
> Yves
I would probably leave the behavior as it is for two reasons:

1) Existing code might depend on it being as it is and I would break 
such code only with great reluctance

2) For the same reason that a failed match doesn't reset the numbered 
match variables (as described in perlre)

Not because I like the way that it is. The rare cases where the 
persistence was valuable would probably be much clearer and less 
vulnerable (e.g. to a continue block being added to the loop) if the 
persistence were provided explicitly.


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