Support of algebraic operations on sets

Bert Freudenberg bert at freudenbergs.de
Sat Jun 16 11:13:48 UTC 2007


On Jun 16, 2007, at 10:37 , sig wrote:

> I'd like to see useful code which uses #difference: for dictionaries
> with current semantics.

I'd like #difference: to have the same semantics for every  
Collection. Including, of course, Sets and Dictionaries.

> I don't want to explain a newcomer about Set which behaves as
> not set, because "it's implemented using language specific
> standards/rules". Then there's no reasons to call it a set. I think
> the choice to call a set 'Set' was to make it conforming with algebra
> and implementing   #union:, #intersection:, #difference: too.

Completely agreed.

> As i said before, if Association uses both key and value in
> comparison, then this class have no value at all and degenerates into
> array of two elements.

I'm not sure why this was changed, but one could argue either way.  
Anyhow, this is secondary to the Collection discussion, as it is an  
implementation detail of Dictionaries.

> And dictionary degenerates to something in the middle between Set and
> OrderedCollection.
> Dictionary is a subclass of Set, it must be more specific, while still
> behave as set. But to what we see, it magically becomes less specific
> by violating rules defined in parent class(es).

That is exactly the point. That's why it should not be a subclass of  
Set, as Nic already suggested.

> No, i would like to keep a Dictionary be subclass of Set.

I'm trying hard to understand you. Do you suggest that a Dictionary  
method like #includes: operates on the keys while #do: operates on  
the values? Isn't that ridiculous? Or should all collection  
operations work on the keys to be like a Set? How would you access  
the values then? In any case, this would be a completely new concept  
and should not be called Dictionary.

- Bert -





More information about the Squeak-dev mailing list