[squeak-dev] Re: Why is Heap>>#species => Array?

Klaus D. Witzel klaus.witzel at cobss.com
Fri Feb 22 07:49:08 UTC 2008


On Fri, 22 Feb 2008 06:22:32 +0100, Paolo Bonzini wrote:

> Klaus D. Witzel wrote:
>> Subject line says it all, check yourself,
>>  (Heap withAll: 'array') reject: [:x | x = $r]
>>  What's the rationale (there's no doc, no comment)? Archive shows that  
>> #species was changed to fix another (anonymous) bug but, this way the  
>> senders of #species can impossibly do what Smalltalk users expect from  
>> the collection hierarchy (and there is #asArray ...)
>
> You answered yourself as to the solution, which is to use #copyEmpty  
> more even in Collection (especially in #select: and #reject:).  #species  
> should be used only for #collect: (and even then, it only works by  
> chance, i.e. because sorted collections' #collect: methods return  
> something for which "self species new" is good enough).
>
> There shouldn't be any need to define any #...ect: method except in  
> Collection and ArrayedCollection.

Agreed and thanks for the feedback :)

> Paolo
>
>
>





More information about the Squeak-dev mailing list