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

Re: Assigning an array to a nameref "placeholder"



On Mon, Feb 26, 2024 at 2:18 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> Another one from the ksh93u+ gitlab:
>
> > 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?

Incidentally:

% typeset x
% typeset -p x
typeset x=''
% x+=(a b)
% typeset -p x
typeset -a x=( '' a b )

This has been the case for as long as += has been around, as far as I
can tell.  Works this way even with typesettounset, but not if the
parameter was never declared or has been explicitly removed with
"unset".




Messages sorted by: Reverse Date, Date, Thread, Author