[Box-Admins] Re: [Squeak 0006937]: removeAll: aCollection doesn't do what we expect if aCollection==self

Klaus D. Witzel klaus.witzel at cobss.com
Tue Feb 19 21:30:45 UTC 2008


Sorry, wrong email headers ...

On Tue, 19 Feb 2008 22:16:54 +0100, Klaus D. Witzel wrote:

> Hi nicolas,
>
> in your "counter" example you have forgotten that this bug is about  
> failure of removal, but your example does not fail, instead it removes  
> all elements (in Squeak 3.9, where MappedCollection still exists).
>
> Can you tell us why? And please only add code to bug reports which does  
> what you claim; things which don't work can be discussed here :)
>
> /Klaus
>
> On Tue, 19 Feb 2008 21:28:25 +0100 a NOTE has been added to this issue:
>> ======================================================================
>> http://bugs.squeak.org/view.php?id=6937
>> ======================================================================
>> Reported By:                cdrick
>> Assigned To:
>> ======================================================================
>> Project:                    Squeak
>> Issue ID:                   6937
>> Category:                   Collections
>> Reproducibility:            always
>> Severity:                   minor
>> Priority:                   normal
>> Status:                     new
>> ======================================================================
>> Date Submitted:             02-19-2008 18:12 UTC
>> Last Modified:              02-19-2008 20:28 UTC
>> ======================================================================
>> Summary:                    removeAll: aCollection doesn't do what we  
>> expect if
>> aCollection==self
>> Description:
>> This known error has had a revival originating from a mail of Sophie in  
>> the
>> beginnner list... and I ended up opening a bug report...
>>
>> The problem is:
>>
>> col := #(1 2 3) asOrderedCollection.
>> col  removeAll: col.
>> ^col   returns an OrderedCollection(2) instead of an empty one as we  
>> would
>> expect...
>> ======================================================================
>>
>> ----------------------------------------------------------------------
>>  kwl - 02-19-08 18:51
>> ----------------------------------------------------------------------
>> OrderedCollection-removeAll-kwl-6937.st tested with the 441 cases in the
>> CollectionTests category, all green.
>>
>> ----------------------------------------------------------------------
>>  nicolas cellier - 02-19-08 20:28
>> ----------------------------------------------------------------------
>> "As posted in beginners list, self == aCollection does not handle case  
>> when
>> aCollection is just a wrapper on self...
>> So the change won't removeAll problems...
>> in a 3.9 image try this:"
>>
>> | collec1 collec2 |
>> collec1 := OrderedCollection with: 'a' with: 'b' with: 'c'.
>> collec2 := MappedCollection collection: collec1 map: (3 to: 1 by: -1).
>> collec1 removeAll: collec2.
>> collec1 inspect
>>
>> "Agree, yet, the problem lies in super...
>> Note: MappedCollection was removed from 3.10, but in spirit there can be
>> other wrapper collections (i used some myself)."
>>
>> Issue History
>> Date Modified   Username       Field                    Change
>> ======================================================================
>> 02-19-08 18:12  cdrick         New Issue
>> 02-19-08 18:51  kwl            File Added:
>> OrderedCollection-removeAll-kwl-6937.st
>> 02-19-08 18:51  kwl            Note Added: 0011843
>> 02-19-08 20:28  nicolas cellierNote Added: 0011846
>> ======================================================================
>>
>



More information about the Box-Admins mailing list