[squeak-dev] Re: Why is Heap>>#species => Array?
Paolo Bonzini
bonzini at gnu.org
Fri Feb 22 05:22:32 UTC 2008
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.
Paolo
More information about the Squeak-dev
mailing list
|