2009/12/23 Stéphane Ducasse <stephane.ducasse@inria.fr>:
Apparently sort: is not understood by SortedCollection :( And sortBlock: is not understood by ArrayedCollection subclasses :( So this is cool OrderedCollection does not understand sort:
Could we dare to fix that? Does anybody have a solution?
Stef
ArrayedCollection>>sort: aSortBlock     "Sort this array using aSortBlock. The block should take two arguments     and return true if the first element should preceed the second one."
    self         mergeSortFrom: 1         to: self size         by: aSortBlock
SortedCollection>>sortBlock: aBlock     "Answer an instance of me such that its elements are sorted according to     the criterion specified in aBlock."
    ^(super new: 10) sortBlock: aBlock
Oh that one bugs me... You also have asSortedArray asSortedCollection asSortedCollection: sortBy: A bit too many selectors? The different semantics currently are: - sort in place - #sort and #sort: - make a sorted copy - #asSortedArray does except if already isMemberOf: Array and isSorted, #sortBy: does too but is only understood by SequenceableCollection (stupid) - make a sorted collection that can further sort added elements - #asSortedCollection #asSortedCollection: #sortBlock: has 2 semantics: instance creation and modifying the sort block of an instance... And I would like another message to avoid all these keys asArray sort I spreaded in trunk: - sort in place if possible (if Sequenceable), or create a sorted sequence otherwise But you can understand I did not dare adding a new selector :) Nicolas
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project