Dictionary>>collect: vs. Dictionary>>select: : why are theydifferent?

Brian T Rice water at tunes.org
Sat Nov 15 01:27:08 UTC 2003


On Sat, 15 Nov 2003, Andreas Raab wrote:

> [Re: Dictionary>>collect:]
> > Can anyone say whether this is the desired behavior?
>
> Good question. A better one might even be if that's "reasonable" behavior.
> If I look at #collect: it does appear to be more reasonable to answer a
> dictionary which maps the same keys to different values.
>
> > Also, it looks like I can gain about 20% in speed simply, and
> > also reduce the creation of extra objects (we don't *really* need
> > Associations in the dictionary, do we?):
>
> I would not want to change this. If you're planning to put away with
> associations for certain kinds of dictionaries (for example,
> MethodDictionary is an IDDict which has no associations) it seems better to
> set up a new branch in the class hierarchy. Call it Map and IdentityMap if
> you want to.

It's generally called LookupTable in other Smalltalks, if you're looking
for consistency and some portability.

> Cheers,
>   - Andreas

-- 
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/



More information about the Squeak-dev mailing list