[squeak-dev] Re: Why is Heap>>#species => Array?
Klaus D. Witzel
klaus.witzel at cobss.com
Thu Feb 21 22:40:52 UTC 2008
On Thu, 21 Feb 2008 22:56:15 +0100, nicolas cellier<wrote:
> Klaus D. Witzel a écrit :
>> 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 ...)
>>
>
>
> I think this is mainly because of collect:
That's about the same that I wrote about in the other message :)
> Since collect: will potentially change class of elements, it would make
> sortBlock: fail.
>
>
> | heap |
> heap := Heap withAll: (1 to: 10).
> self shouldnt: [heap collect: [:e | e even]] raise: Error.
>
> Of course, another solution like adopted in SortedCollection would be to
> define Heap>>collect: rather than Heap>>species.
>
> But there might be other reasons...
I don't think so, the March 2000 bug fix post talked about enumeration
problem, I think we have it now (reconstructed the cause :) Good work
Nicolas !
> Nicolas
>
>> -
>> http://lists.squeakfoundation.org/pipermail/squeak-dev/2000-March/011043.html
>> /Klaus
>> P.S. Heap is used in not-so-uncritical parts, like
>> #startTimerEventLoop and WorldState, so I don't want to "just" play
>> with Heap's #species without any background info on what was fixed.
>>
>
>
>
More information about the Squeak-dev
mailing list
|