[squeak-dev] Re: intersection: method for dictionaries flaky

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Tue Jul 28 07:59:54 UTC 2009


2009/7/28 Paolo Bonzini <bonzini at gnu.org>:
>
>>> I propose that the intersection of two Dictionaries should either
>>>    a)  Return the intersection of the keys of the Dictionaries.
>>>         Not an intuitive answer either but better than now.
>>>         For example, what would you expect the intersection of two
>>> MethodDictionaries
>>>         to be?
>
> I second this.  It is extremely unlikely that someone is using to intersect
> values, since the unique values of a Dictionary (the "Set"-like values) are
> actually the keys.
>

I would rather tend to explicitly type (a keys intersection: b keys).

>>>    b)  Generate the shouldNotImplement error.
>>>
>>
>> c) make Dictionary be not the subclass of Set, then questions, like
>> wrong #intersection: symmetry will auto-become a non-issue. :)
>
> Paolo
>
>

I already implemented c) once for fun.
See the thread starting at
http://lists.squeakfoundation.org/pipermail/squeak-dev/2007-June/117840.html
... and my arguments for moving Dictionary and Set under a common
HashedCollection
http://lists.squeakfoundation.org/pipermail/squeak-dev/2007-June/117894.html

Nicolas



More information about the Squeak-dev mailing list