Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Assigning an array to a nameref "placeholder"
- X-seq: zsh-workers 52630
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Assigning an array to a nameref "placeholder"
- Date: Wed, 28 Feb 2024 05:28:41 +0000
- Archived-at: <https://zsh.org/workers/52630>
- In-reply-to: <CAH+w=7ZhN0=WXdcDuNzEo5gVN6P9uDw1Gx5zB3tNYRPXuKEigQ@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=7YPkNSiSC_mp-THHvV-fV_rnbrrhVy6Q00ybeszVPUeyw@mail.gmail.com> <20240227064807.xa77q6qjek77nekq@chazelas.org> <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@xxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author