Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: indirect array element assignment?
- X-seq: zsh-users 27864
- From: "Anthony Heading" <ajrh@xxxxxxxx>
- To: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- Cc: "Zsh Users" <zsh-users@xxxxxxx>
- Subject: Re: indirect array element assignment?
- Date: Sun, 03 Jul 2022 12:43:54 -0400
- Archived-at: <https://zsh.org/users/27864>
- Feedback-id: i6aa94791:Fastmail
- In-reply-to: <CAH+w=7ZrmLt7i+LXYG6CiM6X1pBBaSH5HSnQwBEbGU=1Qdi0VQ@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <11ca04c9-1503-4cd2-a44b-635dc53e43a8@www.fastmail.com> <CAH+w=7YCZDE3OCFakdGfxEptnM=8zwvG3PBEH-FnSi+=oTM7pA@mail.gmail.com> <a6b9657e-acf2-4871-ae8e-9700dcaac780@www.fastmail.com> <CAH+w=7ZrmLt7i+LXYG6CiM6X1pBBaSH5HSnQwBEbGU=1Qdi0VQ@mail.gmail.com>
On Sat, Jul 2, 2022, at 11:41 PM, Bart Schaefer wrote:
> That does in fact mean that this works too, now that I think of it:
>
> ${(P)${:-${v}[2]}::=mango}
Even better! Though gosh it does start to cry out for dedicated
assignment syntax/parsing. I always though it was rather a pity that
some predecessor (ksh maybe?) claimed 'let' for arithmetic so it's
not free: let ${v}[2] ?= (peach apricot) etc would be easier
to deal with. But perhaps this was the thought-process that
unleashed csh on the world, so maybe not.
> For that to work, ${${X}} would have to mean the same as ${(P)X}. As
> a general rule nested expansions are processed innermost-leftmost, and
> substitute rvalues rather than lvalues.
Yes. It didn't seem *too* far off, but I traced it now with gdb
through paramsubst() and I follow what you mean.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author