Stephen Compall wrote:
> I would suggest that addAllAssociations: have the current behavior of
> addAll:, but that would likely lead to confusion, as the relationship
> between addAll: and addAllAssociations: would be precisely the opposite
> of that between do: and associationsDo:.  On the other hand,
> associationsDo: is not even part of <abstractDictionary>....

#associationsDo: is not optimal;  it says "here's a collection of stuff,
including associations, so lets do something to these associations, but
not other elements", but that's not what really happens.

Same for #do: -- if you see a Dictionary as a Collection of
Associations, being able to iterate over them with #do: seems natural.
Likewise for being able to add a Dictionary to a Dictionary.  And
likewise for being able to initialize a Dictionary from an Array, or any
other Collection, of Associations.  (Including Dictionary itself.)  All
of these things are neither confusing nor useless.  Quite the opposite.

I don't see a reason to follow the standard so closely that it would
make for a less useful behaviour.

Let's just remove #do: from Dictionary (say, move its functionality to
#valuesDo:) and do away with the misleading #associationsDo: (whose
functionality will be taken care of by the inherited #do:).  Some
incompatibility is a very small price to pay for this.

Jānis



_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to