[squeak-dev] IdentitySet>>collect:

Levente Uzonyi leves at elte.hu
Sat Nov 29 14:55:57 UTC 2014


On Fri, 28 Nov 2014, tim Rowledge wrote:

>
> On 28-11-2014, at 6:05 PM, Levente Uzonyi <leves at elte.hu> wrote:
>
>> I think the conclusion was that it's better to leave the method as it is, because there's no better way to do it.
>
> There’s *always* a better way to do it. Somebody just has to think about it the right way.

There are too many factors for a better solution to exist.
Let's say we change the method to return a Bag. Some will say it's better 
that way, because the resulting collection has the same size as the 
original.
And some people will say that you broke their code, because the following 
will return false instead of true:

| s t |
s := #(1 2 3) asSet.
t := s collect: [ :each | each ].
s = t

IMHO the best solution is still to replace sends of #collect: with
#collect:as:, but it's a lot of work.

Levente

>
>
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> It is easier to change the specification to fit the program than vice versa.
>
>
>
>


More information about the Squeak-dev mailing list