[squeak-dev] Re: #collect: on strings

stephane ducasse stephane.ducasse at free.fr
Fri Jun 27 06:49:47 UTC 2008


I still think that I would like to see the result of an efficient  
as:collect:.
Damien I would like to find the time to write ToCo (trait for  
collection :)).
I understand the motivation of damien.
The discussion was interesting for me. I like when nothing is black  
and white because
this is that we closer to real life.

Stef

> Whatever attracting the idea might be,
> implementation won't be obvious, some recipient collections using  
> add:, some
> others at:put:.
>
> Probably you will have to dispatch to recipient sending a  
> #collect:from:.
> Then if you want to preserve efficiency of optimized to:do: loops in  
> case both
> collections are ArrayedCollection, or at least recipient is Arrayed  
> and source
> is Sequenceable, then you might have to implement double  
> dispatching...
> #collect:fromArrayedCollection:.
>
> Double dispatching would be a must to handle tricky Dictionary case  
> - use same
> keys when collecting into a Dictionary, arbitrary key remapping when  
> collecting
> into an ArrayedCollection and no key at all when collecting into a  
> Bag or Set...
>
> The idea of simplifying code by factorization might be spoiled by  
> these details,
> and IMO is void.
>
> Nicolas
>
>
>




More information about the Squeak-dev mailing list