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

nicolas cellier ncellier at ifrance.com
Thu Feb 21 21:06:28 UTC 2008


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 have not the background to answer you.
All I can tell is that this triggers another associativity failure:


	| anArray heap1 heap2 |
	anArray := #(1 2 3).
	heap1 := Heap withAll: (1 to: 3) sortBlock: [:a :b | a < b].
	heap2 := Heap withAll: (1 to: 3) sortBlock: [:a :b | b > a].
	(heap1 = anArray) & (heap2 = anArray) ==> (heap1 = heap2)

Heaps do compare their sortBlock.
They are more relax when comparing with their species.

This is minor, but note nice.

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