[Pharo-project] [Seaside-dev] GROrderedCollectionTest>>#testSort

Paolo Bonzini bonzini at gnu.org
Wed Feb 17 09:59:57 EST 2010

> I understand and I agree with Pharo not to implement #sort and #sort:
> in SequenceableCollection, because it does not make sense for most
> subclasses. SortedCollection, Heap and Interval are already sorted;

Interval and SortedCollection are only sorted according to one 
particular sort block, which may not be the default sort block (e.g. for 
decreasing intervals).  For Interval the only sensible solution is 
#shouldNotImplement, but for SortedCollection it is plausible to make 
#sort or #sort: change the collection's sort block.

> and for LinkedList sorting does not really make sense.

Why not?  Unlike arrays you can do linked list mergesort without 
auxiliary space (though the linked list already has O(n) overhead so 
that means without extra space compared to what the data structure 
already needs), and it is still guaranteed O(n log n).  Of course I'm 
not really suggesting to implement LinkedList>>#sort. :-)

> So I don't really know what to do to fix the Seaside test. We could
> ask the Pharo guys to integrate OrderedCollection>>#sort and
> OrderedCollection>>#sort: into Pharo 1.0, but maybe that's already too
> late?

Grease-Squeak should provide it.


More information about the Pharo-dev mailing list