On Wed, Dec 23, 2009 at 9:22 AM, Levente Uzonyi <leves@elte.hu> wrote:
On Wed, 23 Dec 2009, Julian Fitzell wrote:
#sort and #sort: -- Squeak/Pharo have it on ArrayedCollection, VW has it on SequenceableCollection, and VASt will now add it. This sorts the instance in place.
The problem here is that not all SequenceableCollections are sortable, for example instances of Interval can't be sorted. In squeak trunk ArrayedCollection and OrderedCollection understand both.
Meh... Interval shouldn't inherit #at:put: either, but it does. It's just life with the Collection hierarchy we have. In fact, on VW at least, #sort: is implemented in terms of #at:put: so trying to sort an Interval just triggers an Exception saying "you cannot store into an Interval". But how platforms choose to implement it is really up to them - the goal is that any Collection that should be sortable in place responds to #sort and #sort: somehow, whether that's through inheritance, traits, or multiple implementations, I don't (personally) care.
#sorted, #sorted: -- VW already has this. VA is adding it. Squeak/Pharo should add it, IMO, but we'll add it to Grease if not. It returns a sorted copy of SequenceableCollections and a sorted Array of all other collections.
+1, except for SequenceableCollection, see above
Yes, Intervals are a bit weird in this case - again, I'd lean towards #shouldNotImplement unless it fails naturally in some other way but I don't feel strongly about it. Our platforms tests will test for it on individual classes; again, how exactly the behaviour ends up on each of those classes is not that important to me. Julian