bug-bash
[Top][All Lists]
Advanced

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

UUID as Array Keys strangely not possible


From: Robert White
Subject: UUID as Array Keys strangely not possible
Date: Tue, 22 Jan 2019 20:32:31 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

Howdy,

The following cannot work because, for some reason, the array subscript parser insists on doing math on array indices even when the array is associative instead of numeric

typeset -A UUID_TABLE
...
UUID_TABLE+=( [${SOME_UUID}]=${SOME_VALUE} )
...
some_command ${UUID_TABLE[${SOME_UUID}]}

The parser and evaluator insist on doing math on ${SOME_UUID} no matter how its quoted or whatever. This seems extremely wrong.

At a minimum putting the index in double quotes should suppress the arithmetic evaluation. In the ideal the decision to math-or-not decision should happen after the array type is known, thought that's probably too hard.

Alternately some sort of builtin hash function to map complex strings into usable associative array indexes would be nice.

UUIDs are simply too useful and common in current systems to sustain their current second-class status.

(DISCLAIMER: I'm not a subscriber to this list.)



reply via email to

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