zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Stephane Chazelas <stephane@chazelas.org>
Cc: zsh-workers@zsh.org
Subject: Re: nameref and argv
Date: Tue, 21 Nov 2023 10:35:51 -0800	[thread overview]
Message-ID: <CAH+w=7aEv+iywu4qav+GmCBfOCxhSU0ASUp2vJ-6maW9ZORK6g@mail.gmail.com> (raw)
In-Reply-To: <37aad408d2bbe8d7738f77e9cfd1f1dc@chazelas.org>

On Tue, Nov 21, 2023 at 2:27 AM Stephane Chazelas <stephane@chazelas.org> 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.


      reply	other threads:[~2023-11-21 18:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-21 10:27 Stephane Chazelas
2023-11-21 18:35 ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7aEv+iywu4qav+GmCBfOCxhSU0ASUp2vJ-6maW9ZORK6g@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=stephane@chazelas.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).