Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Up-scope named references, vs. ksh
- X-seq: zsh-workers 52653
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Up-scope named references, vs. ksh
- Date: Sun, 3 Mar 2024 13:44:13 +0000
- Archived-at: <https://zsh.org/workers/52653>
- In-reply-to: <CAH+w=7bVzYFBsqpZy40GEJ6qGpM+BQz9AbY=3eTtW_2B4wB3dA@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- References: <CAH+w=7aKwKhdXjPo2FQG1GqjHQzX=5to_m6kZeL-UFfQh_XMtw@mail.gmail.com> <20240211070042.4j37hkgjjn3dfjqd@chazelas.org> <CAH+w=7ateaqX5azdifTaFpJT6sX-fVhnEazgeYYXSWtJY8EQTw@mail.gmail.com> <CAH+w=7akb334QvsofyMLtc7_091bmP=omjAGOZSc8eH8FWuTqQ@mail.gmail.com> <20240220210553.g6imt3op6zahz4pa@chazelas.org> <CAH+w=7bucofSovKLc0kJeMT3RcKUc8ydhFSaGQqMALvJ_0S21Q@mail.gmail.com> <20240221201215.anpjcfav6na55gg6@chazelas.org> <CAH+w=7aGtWkXFYXQRnL808CscE0=CsAvA3zpoUK6LcSzk5JEww@mail.gmail.com> <20240301182238.tpyajwblbam5bxw7@chazelas.org> <CAH+w=7bVzYFBsqpZy40GEJ6qGpM+BQz9AbY=3eTtW_2B4wB3dA@mail.gmail.com>
2024-03-01 15:28:58 -0800, Bart Schaefer:
> On Fri, Mar 1, 2024 at 10:22 AM Stephane Chazelas <stephane@xxxxxxxxxxxx> wrote:
> >
> > $ ./Src/zsh -c 'f() { typeset -n ref=$1; unset ref; local var=2; ref=3; }; typeset -A var; f var; echo $var'
> > <empty>
>
> That's an actual bug, regardless of the rest of this discussion.
[...]
If that one can be fixed then why can't the main one, namely:
assign() {
typeset -n var=$1
typeset value=$2
var=$value
}
assign value x
echo $value
(or assign var x returning an error)
be fixed the same way, that is typeset -n ref=var doing the
equivalent of assigning var and unsetting afterwards if it is
previously not found?
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author