Support of algebraic operations on sets
siguctua at gmail.com
Fri Jun 15 15:34:58 UTC 2007
> The actual problem here is that Dictionary is implemented as a
> subclass of Set while it is no proper Set. If it wasn't, then the
> #union: implementation in Collection would do The Right Thing. Of
> course we'd need Dictionary>>asSet defined as "^self values asSet".
no, it leads nowhere , because if you return keys or values in #asSet
you losing opposite part of assotiation. also note, that 'self value
asSet' will return you a set where same value appear only once, which
is not true for dictionary.
> So IMHO what *should* happen is that #union: always answers a Set.
> Actually, the only sensible thing would be to take the values IMHO.
I'm not agree. A values in dictionary are accessible only by keys.
They have no meaning w/o keys.
Keys in dictionary much more sensible than values. And that's why
dictionaries inherited from sets IMHO. And must behave as sets in
union/difference/intersection operations based only on keys.
> - Bert -
More information about the Squeak-dev