Hi list, this is a copy of a proposal that I dumped into the bugtracker as http://code.google.com/p/pharo/issues/detail?id=1346.
An OrderedCollection returns a copy on #sortBy:, while an ArrayedCollection returns a changed self on #sort:. ArrayedCollection does understand #sortBy:, while OrderedCollection does not understand #sort:. In VW and Squeak, OrderedCollection understands sort:, and it sorts inline. I'd like to propose two things (1) Add sort: to OrderedCollection, LinkedList and Heap (all of them understand at: put: since this weekend. and then (2) remove sortBy: I understand that point 2 might be controversial. I'd like to argue for it as follows: the naming sort vs. sortBy: is more than misleading, they appear to be synonyms, but they really do different things. The principle of the least surprise tells me that we should not have such behavior in the system. I'd like to argue that we want to erase the possible source of confusion, that is change sortBy: such that it either does the same as sort: or goes away. I'd like to leave #sort: the way it is because at any rate, we need to have an in-place sort, so why not keep the sort that sorts in- place. I'd argue it should go away, such that code that currently calls sortBy: does not call a method with changed semantics, which is difficult to debug. A DNU is easy to debug: you just change it to the now appropriate call. For me the most reasonable options are these: - rename #sortBy: to #copySortedBy: - remove #sortBy: Out of these, I'd vote for removing, since #copySortedBy: is not really shorter than 'copy sort:'. Cheers, Niko _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project