[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] CharacterArray class>>#lineDelimiter and Dictionary

From: Jānis Rūcis
Subject: Re: [Help-smalltalk] CharacterArray class>>#lineDelimiter and Dictionary>>#addAll: both fail
Date: Fri, 23 Mar 2007 14:54:45 +0200
User-agent: Icedove (X11/20061220)

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]