zsh-users
 help / color / mirror / code / Atom feed
From: "Anthony Heading" <ajrh@ajrh.net>
To: "Bart Schaefer" <schaefer@brasslantern.com>
Cc: "Zsh Users" <zsh-users@zsh.org>
Subject: Re: indirect array element assignment?
Date: Sun, 03 Jul 2022 12:43:54 -0400	[thread overview]
Message-ID: <1abf958a-d326-400e-97ec-aaec04ed2c11@www.fastmail.com> (raw)
In-Reply-To: <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.



      reply	other threads:[~2022-07-03 16:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-02 10:33 Anthony Heading
2022-07-02 18:13 ` Bart Schaefer
2022-07-02 18:23   ` Bart Schaefer
2022-07-03  2:28   ` Anthony Heading
2022-07-03  3:41     ` Bart Schaefer
2022-07-03 16:43       ` Anthony Heading [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=1abf958a-d326-400e-97ec-aaec04ed2c11@www.fastmail.com \
    --to=ajrh@ajrh.net \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-users@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).