At 10:28 AM 8/31/98, Patrick Logan wrote:
The problem with the new versions is that we are forgeting special the SortCollection protocol.
#addLast: adds an element without resorting (sneaky)
Why is #addLast allowed to be sneaky but #at:put: is disallowed altogether?
SortedCollections are never guaranteed to have any element at a particular location, just in order. If you insert an element at a location, the ideal SortCollection will immediately resort itself to stay correct. The element will more than likely not still be at the location you put it in, making #at:put: meaningless. By this reasoning _all_ the inherited adding methods are also meaningless except #add:. To this end I have added:
SortCollection>>#addWithoutSorting: anObject ^super add: anObject
and changed #copyFrom:to: to use #addWithoutSorting: instead of inappropriately using #addLast:.
--Maurice
--------------------------------------------------------------------------- Maurice Rabb 773.281.6003 Stono Technologies, LLC Chicago, USA
squeak-dev@lists.squeakfoundation.org