Is there an Ordered Dictionary?

John M McIntosh johnmci at
Thu Jan 9 22:36:07 UTC 2003

On Thursday, January 9, 2003, at 02:08  PM, Andreas Raab wrote:

> If you use #keysAndValuesDo: for enumeration the system will give you
> the "integer keys" for sequenceable collections, so in most cases I
> prefer this protocol (and yes, I think the inconsistency between
> #keysAndValuesDo: and #associationsDo: is quite annoying).

mm I can relate an interesting story about someone I knew that had some  
code that iterated over
the dictionary and got stuff back in the 'correct' order. But when we  
changed the dictionary structure to
deal with very large dictionaries, why his order changed, so did the  
assumptions and boy did it take
a little while to figure out why the code failed some of the time...

In reviewing that, I think before the ANSI standard came out we noted  
some warnings (I think in the
Visualworks code base) about not assuming that iterating over a  
dictionary will give you items in a particular order.
But my memory is fuzzy on that.

John M. McIntosh <johnmci at> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.

More information about the Squeak-dev mailing list