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

Re: [PATCH] (?) typeset array[position=index]=value



Stephane Chazelas wrote on Wed, 02 Jun 2021 09:11 +00:00:
> Maybe the best approach would be to make unset a dual
> keyword/builtin like typeset/export... so one can do:
> 
> unset hash[$key]
> 
> And that hash[$key] being interpreted the same as when you do:
> 
> hash[$key]=value

Haven't read the whole thread, so apologies if I'm missing something, but:

Please let's not invent a reserved word that uses different variable
expansion rules.  The sequence «hash[$key]» should mean the same thing
everywhere.  Instead, we could have a builtin that takes two separate
arguments, as in «foo hash $key» (and «foo hash ''» to unset the element
whose key is the empty string).

Makes sense?

Cheers,

Daniel




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