Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16206

Re: [PATCH] Implement rehashing for associative arrays (Re: speeding up hash_search?)

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: [PATCH] Implement rehashing for associative arrays (Re: speeding up hash_search?)
Date Mon, 20 Apr 2020 17:50:25 -0400
Lines 26
Approved bug-bash@gnu.org
Message-ID <mailman.841.1587419444.3066.bug-bash@gnu.org> (permalink)
References <CALv3B7aiTbhpyUL17Eg5prH39EgMP8uSDdD554OdND3LFETAQg@mail.gmail.com> <CAFLRLk8ydO6ev8wRcJ35kzzN3Yt2_9sjsc6L+C0CC6dCxud_NA@mail.gmail.com> <CALv3B7bzh3degKPCe5c_avUc90L+bE8jqKKcaVo13zwqEyB5-A@mail.gmail.com> <CAFLRLk-XAU3rrRHy1wWdY7Py-gkLaU-UfiPc47MOEA8eutYx1A@mail.gmail.com> <20200420124911.GW845@eeg.ccf.org> <a351bc16-182b-b2e9-319d-e9d1615f209a@case.edu> <CAFLRLk_KetD6+-o2HOdP6ueKuynu_7Yn6ARZ_HbC4QC=99-WcA@mail.gmail.com> <CALv3B7YTnS8R8D=dYbbOUFROOvhSQ1gfc_ETT+cikp3onBMR1A@mail.gmail.com> <61c51c64-d17e-6ea0-6ace-0c3365ef2299@case.edu> <CALv3B7Yrg7bDO0eViSTBWad56vw_dGnnXtMRa9ofYysiAiYJbA@mail.gmail.com> <20200420215025.GZ845@eeg.ccf.org>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace usenet.stanford.edu 1587419444 18057 209.51.188.17 (20 Apr 2020 21:50:44 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
Mail-Followup-To bug-bash@gnu.org
Content-Disposition inline
In-Reply-To <CALv3B7Yrg7bDO0eViSTBWad56vw_dGnnXtMRa9ofYysiAiYJbA@mail.gmail.com>
User-Agent Mutt/1.10.1 (2018-07-13)
Received-SPF none client-ip=139.137.100.1; envelope-from=wooledg@eeg.ccf.org; helo=mail.eeg.ccf.org
X-detected-operating-system by eggs.gnu.org: First seen = 2020/04/20 17:50:26
X-ACL-Warn Detected OS = Linux 2.2.x-3.x [generic] [fuzzy]
X-Received-From 139.137.100.1
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <20200420215025.GZ845@eeg.ccf.org>
X-Mailman-Original-References <CALv3B7aiTbhpyUL17Eg5prH39EgMP8uSDdD554OdND3LFETAQg@mail.gmail.com> <CAFLRLk8ydO6ev8wRcJ35kzzN3Yt2_9sjsc6L+C0CC6dCxud_NA@mail.gmail.com> <CALv3B7bzh3degKPCe5c_avUc90L+bE8jqKKcaVo13zwqEyB5-A@mail.gmail.com> <CAFLRLk-XAU3rrRHy1wWdY7Py-gkLaU-UfiPc47MOEA8eutYx1A@mail.gmail.com> <20200420124911.GW845@eeg.ccf.org> <a351bc16-182b-b2e9-319d-e9d1615f209a@case.edu> <CAFLRLk_KetD6+-o2HOdP6ueKuynu_7Yn6ARZ_HbC4QC=99-WcA@mail.gmail.com> <CALv3B7YTnS8R8D=dYbbOUFROOvhSQ1gfc_ETT+cikp3onBMR1A@mail.gmail.com> <61c51c64-d17e-6ea0-6ace-0c3365ef2299@case.edu> <CALv3B7Yrg7bDO0eViSTBWad56vw_dGnnXtMRa9ofYysiAiYJbA@mail.gmail.com>
Xref csiph.com gnu.bash.bug:16206

Show key headers only | View raw


On Mon, Apr 20, 2020 at 05:12:28PM -0400, George Jones wrote:
> No real opinion on syntax.
> 
> Using something existing:
> 
>     declare -A foo[SIZE]
> 
> seems sensible, especially if there was no semantic meaning (I'm not a fan
> of syntax without semantics .... clutter).

That's pretty C-like, and I don't have any strong dislike of it, but I
feel I should point out that users will need to quote the final argument
if it contains square brackets, just like with unset 'a[i]'.

Another choice would be a more shell-like syntax:

declare -s size -A foo=(...)

I'm curious whether the size has to be specified up front when the array
is declared, or can be adjusted on the fly.  The shell-like syntax feels
more natural if the size is being adjusted, since you can write

declare -s new_size foo

without needing to specify the -A again.  But it's not a huge difference.

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: [PATCH] Implement rehashing for associative arrays (Re: speeding up hash_search?) Greg Wooledge <wooledg@eeg.ccf.org> - 2020-04-20 17:50 -0400

csiph-web