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

Re: [perl #68816] RE match variable scope

Thread Previous
From:
Ian Goodacre
Date:
August 27, 2009 15:34
Subject:
Re: [perl #68816] RE match variable scope
Message ID:
4A9709DF.90804@xtra.co.nz
demerphq wrote:
> 2009/8/27 ian.goodacre@xtra.co.nz (via RT) <perlbug-followup@perl.org>:
>   
>> 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.

Ian

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About