[squeak-dev] Re: Dictionary>>collect: returning OrderedCollection?

nicolas cellier ncellier at ifrance.com
Fri Jun 13 19:06:54 UTC 2008


tim Rowledge a écrit :
> Dictionary>do: etc work on the values of the associations. #collect: 
> should continue the pattern. #associationsDo: etc exist if you need to 
> work with the associations.
> 
> tim
> -- 
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> Artificial Intelligence:  Making computers behave like they do in the 
> movies.
> 

Hi tim and Subbu,
you follow a certain historical logic.
But behaviour could be much simpler and homogeneous with ANSI POV.
Consider current state of Squeak:

1) select: and reject: already return a Dictionary
2) collect: current implementation would answer an OrderedCollection 
which is a nonsense for these reasons:

- there is no reason that values be Ordered since keys are not
- depending on Dictionary allocated size, the order will just change
- answering an OrderedCollection is equivalent to associating integer 
keys to values in an arbitrary random order...

Original st-80 logic would have been to answer a Bag, nothing else.

3) Since Dictionary can answer most of Bag protocol transparently, you 
won't even notice the change if collect: answers a Dictionary. This is a 
transparent operation
Changing collect: does absolutely not change the fact that Dictionary 
can be viewed as a Collection of values...

I vote against this un-necessary associationsCollect:

Nicolas




More information about the Squeak-dev mailing list