Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: nameref and argv
On Tue, Nov 21, 2023 at 2:27 AM Stephane Chazelas <stephane@xxxxxxxxxxxx> wrote:
>
> $ ./Src/zsh -c 'f() { nameref a=argv; g x y; }; g() { echo $a; }; f a b c'
> x y
>
> I was expecting to see "a b c" there
Although argv acts like a local, it's actually a global special, so
you always get the special behavior even when accessing through a
nameref.
I thought I'd mentioned this somewhere in the doc but perhaps not.
Underneath, argv ends up being a pointer into the C stack, so there's
no way to get a reference to it from a called function up to the
caller.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author