2009/12/23 Martin McClure <[email protected]>: > Nicolas Cellier wrote: >>> >>> #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. >>> >> >> Oh, that's exactly the one I would have chosen :) >> We should go for it, both Squeak and Pharo. > > I fear that #sorted is too close to #sort, but with very different > semantics, and could cause confusion. I'd think twice before following > VW's lead on this one. Is this a common enough case to be warrant its > own selector, instead of "myCollection copy sort" which is much clearer > in intent? If so, perhaps #copySorted would be clearer? > > Regards, > > -Martin >
I'd like a selector that I can apply to any collection like a Set too. For example, in some implementations keys are a Set (original st80) in others keys are an Array (Squeak trunk/Pharo). So, in order to have more portable pieces of code I ended up with (self keys asArray sort). Maybe the most simple thing would be to define Collection>>sort ^self asArray sort > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
