|
| From: | Chet Ramey |
| Subject: | Re: The "asort" extension (Was: feature proposal: expand associative arrays in lexicographic order ...) |
| Date: | Wed, 26 Aug 2026 10:30:48 -0400 |
| User-agent: | Mozilla Thunderbird |
On 8/26/26 9:43 AM, Zachary Santer wrote:
Bash could potentially implement a -s "sorted" option for the declare builtin, allowing the user to dictate that expansions of *this particular* associative array be in lexicographic order of keys. That would at least be more granular than a shopt option. Additionally, the LC_ALL/LC_COLLATE that's set when that declare command executes could dictate the collation order in effect throughout the lifetime of this associative array. So, a given red-black tree or whatever could be maintained throughout that time, rather than requiring bash to sort the associative array each time it's expanded.
That's a pretty high implementation and maintenance cost, not to mention
a potential run-time cost, for a feature that historically no one has
requested.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
| [Prev in Thread] | Current Thread | [Next in Thread] |