[FIX] SortedCollectionFix-sr

Stephan Rudlof squeak-dev at lists.squeakfoundation.org
Fri Sep 27 13:27:26 UTC 2002


Richard A. O'Keefe wrote:
<...>

> While anyone's looking at SortedCollection, consider
> 
>     #(3 1 4 1 5 9 2 6 5 3 5) asSortedCollection reversed
> The result prints as
>     a SortedCollection (9 6 5 5 5 4 3 3 2 1 1)
> but has sortBlock nil, so the order disagrees with the sortBlock.
> #reversed does make sense for SortedCollections; it ought to return
> a collection with the opposite comparison.
> 
> 

There may be a problem: if you apply >>reversed multiple times the opposite
comparison sortBlock becomes bigger and bigger, if the implementation just
inverts it by constructing a new one with sending #not to the old. There are
other implementations possible, though.

Greetings,

Stephan
-- 
Stephan Rudlof (sr at evolgo.de)
   "Genius doesn't work on an assembly line basis.
    You can't simply say, 'Today I will be brilliant.'"
    -- Kirk, "The Ultimate Computer", stardate 4731.3




More information about the Squeak-dev mailing list