From: Stephane Chazelas <stephane@chazelas.org>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Assigning an array to a nameref "placeholder"
Date: Wed, 28 Feb 2024 05:28:41 +0000 [thread overview]
Message-ID: <20240228052841.cbfkrk6pkta5z4ob@chazelas.org> (raw)
In-Reply-To: <CAH+w=7ZhN0=WXdcDuNzEo5gVN6P9uDw1Gx5zB3tNYRPXuKEigQ@mail.gmail.com>
2024-02-27 18:10:44 -0800, Bart Schaefer:
> On Mon, Feb 26, 2024 at 10:48 PM Stephane Chazelas
> <stephane@chazelas.org> wrote:
> >
> > 2024-02-26 14:18:03 -0800, Bart Schaefer:
> > >
> > > > nameref unsetref; unsetref+=(foo bar). This now produces a "removing nameref attribute" warning before performing the assignment.
> > >
> > > I would rather make this an error, but it's probably not difficult
> > > either way. Comments?
> >
> > An error (or forbidding typeset -n ref=var without the =var part
> > like in mksh) would make a lot more sense to me as well.
>
> Forbidding "typeset -n ref" would make using the "for" loop variation
> a bit weird, but I'm perfectly fine with an error on assigning
> something nonsensical to a nameref.
The forbidding "typeset -n ref" would also come with removing
that surprising "for" loop variation (also like in mksh) as
discussed in another thread.
I'm still not convinced we have to follow ksh93/bash on that,
but then again I didn't take part of the initial discussions on
namerefs so I acknowledge I may be too late to the party.
--
Stephane
prev parent reply other threads:[~2024-02-28 5:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-26 22:18 Bart Schaefer
2024-02-27 2:51 ` Bart Schaefer
2024-02-27 4:56 ` [PATCH] Appending an array to a scalar Bart Schaefer
2024-02-27 6:48 ` Assigning an array to a nameref "placeholder" Stephane Chazelas
2024-02-28 2:10 ` Bart Schaefer
2024-02-28 5:28 ` Stephane Chazelas [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=20240228052841.cbfkrk6pkta5z4ob@chazelas.org \
--to=stephane@chazelas.org \
--cc=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).