[BUG]Collection>>removeAll:
Ian Piumarta
ian.piumarta at inria.fr
Thu Aug 22 22:39:55 UTC 2002
On Thu, 22 Aug 2002, David Farber wrote:
> So do you (or does anyone else) have a problem with the /semantics/ of
> copy-before-iterate--or is the issue just that the naive
> implementation of actually copying the entire collection is too slow?
It just lets even more worms out of the can:
- Is your proposed copy operation atomic?
- How does it cope with recursion? (What happens in collections that want
to iterate over themselves to create the copy? Where [and why] is the
fixed point? Will I need a recursive mutex to accomplish this?? And
how much extra will _that_ cost me???)
- Is it reentrant? (Can I have one process blocked copying a large-ish
collection when another tries to iterate over the same collection? This
isn't a stupid [or even irrelevant] question: look how world update
works in Morphic.)
> [...rest of message...]
Sounds like we're talking about wrapping transactions around
iterations. ;)
I'm still voting for updating just the method comment. Or, at the limit,
adding this to the problematic methods to make the "contract" explicit:
self assert: [self ~~ aCollection].
(giving any "nanosecond watchers" the possibility of redefining
Object>>assert: to ^self without further ado [or even better, making it a
no-op in the Compiler ;].)
Ian
PS: When you open a can of worms, the only way to get them back into a can
is to use a larger can. ;)
More information about the Squeak-dev
mailing list
|