[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Changing the way bash expands associative array subscripts
From: |
konsolebox |
Subject: |
Re: Changing the way bash expands associative array subscripts |
Date: |
Fri, 9 Apr 2021 06:35:08 +0800 |
On Fri, Apr 9, 2021 at 3:21 AM Chet Ramey <chet.ramey@case.edu> wrote:
>
> On 4/6/21 11:42 AM, konsolebox wrote:
>
> > Or maybe just completely avoid this new behaviors and allow another
> > way to unset an element of an array.
> >
> > a[$key]=()
> > a[@]=()
>
> While this is mildly interesting syntax, and currently an error, I don't
> think we need another new way to do this.
But it has pretty good advantages:
1) Existing scripts that double-quote unset arguments internally don't
break. This is a big change which would prevent elements to be unset,
and could be expensive. It also means less confusion and warnings on
the usage of unset with respect to different versions.
2) The setting and unsetting of an element have clear similar
interpretation and syntax, with no surprises.
3) A new feature that replaces an element with multiple values.
4) Not another compatibility option to add, and internal codes to keep
just to keep compatibility. Means less complexity.
5) If "LinkedHashMap" is implemented, the order in which
"${assoc_var[@]}" expands becomes more predictable.
6) Some Bash-Zsh users might like it.
--
konsolebox
- Re: Changing the way bash expands associative array subscripts, (continued)
- Re: Changing the way bash expands associative array subscripts, konsolebox, 2021/04/09
- Re: Changing the way bash expands associative array subscripts, Chet Ramey, 2021/04/12
- Re: Changing the way bash expands associative array subscripts, Chet Ramey, 2021/04/12
- Re: Changing the way bash expands associative array subscripts, Chet Ramey, 2021/04/08
- Re: Changing the way bash expands associative array subscripts, L A Walsh, 2021/04/13
- Re: Changing the way bash expands associative array subscripts, konsolebox, 2021/04/13
- Re: Changing the way bash expands associative array subscripts, Chet Ramey, 2021/04/13
- Re: Changing the way bash expands associative array subscripts, Chet Ramey, 2021/04/08
- Re: Changing the way bash expands associative array subscripts, konsolebox, 2021/04/06
- Re: Changing the way bash expands associative array subscripts, Chet Ramey, 2021/04/08
- Re: Changing the way bash expands associative array subscripts,
konsolebox <=
- Re: Changing the way bash expands associative array subscripts, Chet Ramey, 2021/04/08
Re: Changing the way bash expands associative array subscripts, Chet Ramey, 2021/04/08