Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Empty element elision and associative arrays (was Re: Slurping a file)



On Sun, Jan 14, 2024, at 11:09 PM, Ray Andrews wrote:
> On 2024-01-14 16:55, Bart Schaefer wrote:
>> (output may vary because associative arrays are not ordered).
>
> I've noticed that.  One  might think that the order of assignment would be 'the order' by inevitability, but that seems not to be the case.  I don't understand how it could be otherwise but nevermind.

Consider learning about how associative arrays are typically
implemented.  Then you would see that there is no "inevitable"
iteration order; one must be usually be chosen and implemented
explicitly, which is extra complexity that many languages choose
not to bother with.

https://en.wikipedia.org/wiki/Associative_array#Ordered_dictionary

-- 
vq




Messages sorted by: Reverse Date, Date, Thread, Author