Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Assigning an array to a nameref "placeholder"



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