[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Greg Wooledge
Subject: Re: [PATCH] Implement rehashing for associative arrays (Re: speeding up hash_search?)
Date: Mon, 20 Apr 2020 17:50:25 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]