Levente Uzonyi wrote:
So the only use-case where SortedCollection is useful (IMO) is when you - have to keep the collection sorted and - you rarely some elements to it
Getting rid of other uses is hard because #asSortedCollection always returns a copy, while most #as* selectors don't.
I was slightly confused by this, but now think I see what you're saying. Most #as* selectors return an instance of a different class, but answer self if the receiver is already of that class. But collections always answer a copy, even if it is already of that class. Wondering why this was designed this way... Perhaps it's the expected mutability of collections? When you send #asInteger, you don't care if you get the receiver back, because it's not mutable. But with a collection you almost always mutate it. In the case of #asString, Strings are mutable, but are not *commonly* mutated. Regards, -Martin