Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Associative array ordering and selective unset (Re: Example function)
- X-seq: zsh-workers 5155
- From: Bruce Stephens <b.stephens@xxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: Associative array ordering and selective unset (Re: Example function)
- Date: 01 Feb 1999 17:39:12 +0000
- In-reply-to: "Bart Schaefer"'s message of "Mon, 1 Feb 1999 09:02:46 -0800"
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <199902011048.LAA07559@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <990201090246.ZM31742@xxxxxxxxxxxxxxxxxxxxxxx>
- Sender: B.Stephens@xxxxxxxxx
"Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx> writes:
> On Feb 1, 11:48am, Sven Wischnowsky wrote:
> } Subject: Re: Example function
> }
> } I was thinking about this... we could make the code keep a counter in
> } assoc arrays, increment it whenever a new key is added and store the
> } current value in the structure for this new element. Then we can treat
> } the whole thing as being sorted by `time of addition'.
> }
> } Hm, does this sound like the right thing?
>
> Almost. Something about it doesn't seem quite right to me, but I
> can't put my finger on what different behavior I'd expect.
It would be a bit tricky to reorder the associative array, wouldn't
it? i.e., if I set up some configuration, and then want to insert
some pattern before some others, then I'd need to recreate the
associative array. Maybe that's OK, but it feels a bit awkward.
Emacs (and other Lisps) has assoc-lists, which is maybe a better model
for this: they're explicitly lists (so they have ordering), but you
can access them by key. I've no idea how this would map onto a shell,
but perhaps this is saying that associative arrays don't quite fit
what's wanted.
> I don't like the idea that every parameter table hash would end up
> with another integer of overhead in every entry, but maybe that's
> not so bad.
I agree, the extra integer is probably trivial.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author