Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: All the way up or current scope
On Sat, May 10, 2025 at 7:19 AM Philippe Altherr
<philippe.altherr@xxxxxxxxx> wrote:
>
> When a function is exited and the scope of named reference is updated because it referred to a local variable of the exited function, should its scope be set to the (new) current scope (i.e., the scope of the calling function) or should it be set all the way up to the scope of the next enclosing rname variable or the global scope if no such variable exists?
>
> The current implementation does the former. I think that the latter would be better.
I've experimented with the latter and concluded that it's just messy
but with no real benefit. It has to be done in two separate passes
over the parameter table so that the exiting scope is fully cleaned up
before any references are updated, it breaks (or at least changes in
what I feel to be confusing ways) the results of the modified nr-test
checks when the stack depth repeatedly grows and shrinks. But the
worst bit is that transitive references ($ref1 -> $ref2 -> $var) can't
be handled independently and appear to need exponentially complex
processing as the chain gets longer.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author