Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Obtaining the names of all local variables



Bart wrote:
> This got me thinking, wouldn't it be helpful if zsh/parameter had an array
> $locals that holds the names of all the local parameters?  Then you could
> 
>     needs_private_scope() { local -h $locals; ... }

I'm not sure I understand how that would achieve a private scope. -h is
only applicable to special parameters. You could do:
  local -h ${(k)parameters[(R)*-special]}

Or you could mark every parameter local.

Oliver



Messages sorted by: Reverse Date, Date, Thread, Author