[squeak-dev] SortedCollections

Chris Muller asqueaker at gmail.com
Sun May 8 18:14:45 UTC 2011


> The case of #asSortedCollection has a simple solution: don't use it. There's
> 99.9% chance that you don't need a SortedCollection. If you want to sort a
> Collection, then use #sort, #sorted, #sort: or #sorted:.

Something in my gut does not like SortedCollections either, and I have
even gone into some of my domains and replaced SortedCollections with
OrderedCollections and put in some strategically-placed #sort:'s.

Since doing that, I am now second-guessing myself; I needed another
placed call to #sort: and the question immediately came to my mind:
Why shouldn't this encapsulate the sorting behavior automatically
whenever it is sent an order-dependent message (like enumeration)?



More information about the Squeak-dev mailing list