zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [PATCH] More rigorous subscript checking in named references
Date: Sun, 12 Feb 2023 15:13:27 -0800	[thread overview]
Message-ID: <CAH+w=7Y_68xGY5+q1rvdi7B0Pj22UzW-RcyafmG7BCxQ2P14LQ@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7Y5Jz0EC2M1NB0fZ_a9S5L=VJ-ARC06Qsg6zNTJRm8Vtw@mail.gmail.com>

On Sun, Feb 12, 2023 at 12:16 PM Bart Schaefer
<schaefer@brasslantern.com> wrote:
>
> This covers the case Oliver called out, of extra stuff following a
> valid subscript.

On Sun, Feb 12, 2023 at 2:54 PM Oliver Kiddle <opk@zsh.org> wrote:
>
> That still leaves the oddities with a second subscript:
>
>   typeset -n ref='arr[2][1]'
>   arr=( one two three )
>   echo $ref
>   echo ${ref}
>   ref=Z
>   typeset -p arr
>
> Only case where the second subscript works is when ref is in braces.

Hmm ... I think that has something to do with this:

% arr[2]=two
% arr[2][1]=Z
zsh: no matches found: arr[2][1]=Z

That is, there's a level deeper than where namerefs operate that
doesn't parse past the first subscript.  I'm not sure how hard to work
on that (or if we even want the latter case to work).

I'll keep a note of it, though.


      reply	other threads:[~2023-02-12 23:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-12 20:16 Bart Schaefer
2023-02-12 23:13 ` 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=7Y_68xGY5+q1rvdi7B0Pj22UzW-RcyafmG7BCxQ2P14LQ@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --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).