Cedrick, Nicolas,

I will not be around from Wednesday on for two weeks. Have you seen Keith's message about

- http://installer.pbwiki.com/MinorFixesUnstable-Squeak3%3A10

where he sets a deadline of two weeks. If one of you could add a test before that (from the material discussed) then perhaps #6937 could go for 3.11?

/Klaus

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 22:43 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)."

----------------------------------------------------------------------
 nicolas cellier - 02-19-08 21:09
----------------------------------------------------------------------
"Oops, i copy/pasted the wrong test.
The one that fails is more obvious:"

| collec1 collec2 |
collec1 := OrderedCollection with: 'a' with: 'b' with: 'c'.
collec2 := MappedCollection collection: collec1 map: (1 to: 3).
collec1 removeAll: collec2.
collec1

----------------------------------------------------------------------
 kwl - 02-19-08 21:41
----------------------------------------------------------------------
@nicolas
as mentioned in [EMAIL PROTECTED], since 3.10
MappedCollection no longer exists. Do you have a counter example which
fails indeed in Squeak 3.10; can you break the attached fix in 3.10?

----------------------------------------------------------------------
 nicolas cellier - 02-19-08 22:43
----------------------------------------------------------------------
Proposed change is OK to me. I vote for inclusion in 3.11.
It does not fail per se. super fails...

Simply, i wanted to point that it won't solve all the tricky cases.
So these cases will have to be handled at super level.
And adding a self == aCollection at super level will still have flaws.

MappedCollection is not mainstream anymore, but other wrappers could
become, see LazyLists and LazyCollections in Squeak source...
Collection wrapper is a classical pattern.
As long as they are used under your control, no problem.

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
02-19-08 21:09  nicolas cellierNote Added: 0011847
02-19-08 21:41  kwl            Note Added: 0011848
02-19-08 22:43  nicolas cellierNote Added: 0011850
======================================================================



_______________________________________________
V3dot10 mailing list
[email protected]
http://lists.squeakfoundation.org/mailman/listinfo/v3dot10

Reply via email to