[Top][All Lists]

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

Disabling automatic assoc rehashing

From: Tavis Ormandy
Subject: Disabling automatic assoc rehashing
Date: Tue, 10 Nov 2020 11:16:09 -0800

Hello, I was just checking the new release candidate for compatability with my
builtin and noticed that assoc arrays are now automatically rehashed on 

I knew this day would come :-)

I had been (ab)using the fact that if you created the array with
assoc_create(1), the order of elements would be maintained. This is
because you were effectively creating a linked list rather than a hash

I expect the answer is "too bad", but it would be nice if the rehashing could
be toggled with a flag in the HASH_TABLE, rather than based on the HASH_CREATE
parameter, what do you think?

I'm aware not many people use native builtins, my code is here, it
allows you to use native libraries in bash scripts:


The reason I need assocs that maintain order is so that you can
manipulate and access C structures in bash. For example, if you had a
struct stat, you might want to echo ${stat[st_mtim.tv_sec]}. This
currently works with ctypes.sh, but I think it might not be possible if
there's no way to disable automatic rehashing.

Also, I noticed the definition of ARRAY is now ABI incompatible with builtins
from previous versions because a new member (lastref) was added in the middle
(rather than at the end).


$ finger taviso@sdf.org

reply via email to

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