Support of algebraic operations on sets
Bert Freudenberg
bert at freudenbergs.de
Fri Jun 15 16:00:50 UTC 2007
On Jun 15, 2007, at 17:34 , sig wrote:
>> 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.
Err, we *are* talking about #asSet, which indeed should return a Set
without duplicates.
> I'm not agree. A values in dictionary are accessible only by keys.
Huh? #do: does not need any 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.
I guess these are two different views of Dictionaries. I see them as
unordered variable-sized collections with non-integer indices. Except
for order, a Dictionary with integer keys should pretty much behave
like an OrderedCollection.
You seem to think of Dictionaries as a collection of Associations,
with meaning sometimes placed on the keys, the values, or both. I
guess that's where our difference in understanding comes from.
- Bert -
More information about the Squeak-dev
mailing list
|