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

Julian Fitzell jfitzell at gmail.com
Wed Feb 17 15:15:06 EST 2010

On Wed, Feb 17, 2010 at 5:13 AM, Lukas Renggli <renggli at gmail.com> wrote:
>> #sort you mean? Not yet... we either need to add it in Pharo, fix it
>> in the one click, or add it to the Grease package.
> OrderedCollection>>#sort and OrderedCollection>>#sort: is already part
> of Pharo 1.1. The Seaside tests pass in Pharo 1.1.
> 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;
> and for LinkedList sorting does not really make sense.

As Paolo points out, they are not necessarily sorted by the desired
block. For SortedCollection, I agree the correct behaviour is to set
the sortBlock. VW handles subclasses (like Interval) that cannot be
sorted in place very simply: the sorter is implemented in terms of
#at: and #at:put: and classes that cannot be modified with #at:put:
just return an error saying that they can't be stored into. This also
covers, for example, Arrays that are marked as immutable. There are
many many subclasses of SequenceableCollection that do implement
#at:put: and can be sorted properly...


More information about the Pharo-dev mailing list