On Tue, Jan 25, 2022 at 9:25 AM <hv@crypt.org> wrote: > Why can't we? I think I might have known the answer once, but if I did > I no longer recall it. > > I think of local() as "temporarily replace the value at this lvalue > with a new value, restore it at the end of the current lexical scope". > This is hugely useful in many situations that would otherwise require > more and slower code with much more opportunity for error. > > Is there a technical reason why it would not be possible to implement? > Or is it that we're worried it would be confusing for users? Or is it > only that way back when (around 5.0, I guess) nobody thought it would > be useful? > I might be making this up but my understanding is the technical reason is that local replaces the variable, not the value; which works fine with a package variable that is always enumerable, or an element of an aggregate, but not with a lexical variable. -DanThread Previous | Thread Next