[BUG]Collection>>removeAll:

Tim Rowledge tim at sumeru.stanford.edu
Mon Aug 26 19:30:14 UTC 2002


"Andrew C. Greenberg" <werdna at mucow.com> is claimed by the authorities to have written:

> Richard makes the untrue assumption that the only parameter aCollection 
> that can give rise to this difficulty occurs when aCollection is an 
> identity of self.  This is not the case.  The problems will occur, or 
> similarly buggy problems will occur, WHENEVER a remove: of an element 
> of the receiver will change the parameter.
I have to demur on this point. RAOK is, I'm quite certain, aware of
the full extent of the problem field. So far as I can see he's merely
tried to suggest an attack on a plausibly common element of the problem
set. If we agree to take at face value his suggestion that removeAll can
be spedup by 30%, then I suggest that adding a check for this case is a
good thing. We get a mild speed improvement and a small sanity
improvement thrown in. Let's move on to some of the even more ugly areas
that need fixing. Just take a look through the minefield that is the
Collection hierarchy.

By the way, this is only one side of the problems with enumerating over
collections. You can get major troubles if the collection can contain
multiple instance of the same object and the operations are not
idempotent. 

tim
 

-- 
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
Useful random insult:- Supports nativist theories that man is formed from clay.




More information about the Squeak-dev mailing list