[FIX][ENH] SortedCollection robustness & speedup

Stefan Matthias Aust sma at 3plus4.de
Thu May 4 20:19:48 UTC 2000


At 09:47 02.05.00 +0200, Georg Gollmann wrote:
>At 18:37 Uhr +0200 29.04.2000, Stefan Matthias Aust wrote:
>>While adding the new version of #addAll: to my image, I noticed that this 
>>method was never implemented correctly.  Instead of returning the added 
>>collection as all other implementors of #addAll: do, it returned a the 
>>receiver.  Fixing this as Georg did will break at least 
>>OrderedCollection>>sortBy:
>>
>>I reimplemented this method as
>>
>>   ^ (self asSortedCollection: aBlock) asOrderedCollection
>>
>>which should do the job.  Hopefully nothing else breaks.  I've attached 
>>the whole change set so that you all can test the code.
>
>1) Your changeset unblocks addLast: for SortedCollection which opens the 
>door for sort order corruption. Avoiding that was the main point of my changes.

Yes, I know. Unfortunately, my change sorter and stuff broke, so I undid 
your change instead of trying to hunt down all broken things.  We should 
retarget that change for 2.9a as 2.8 is near and it might risk stability.

>2) Regarding 'sortBy:' I fear we run into a philosophical question. The 
>comment states "Create a copy..." therefore shouldn´t the result be of the 
>same class as the receiver ?

If you don't have subclasses of OrderedCollection, it will be :-)  I think, 
the implementation is as one would think, perhaps the comment has to be 
changed?


bye





More information about the Squeak-dev mailing list