[BUG]Collection>>removeAll:

Stephan Rudlof sr at evolgo.de
Thu Aug 22 23:38:04 UTC 2002


Ian Piumarta wrote:

<snipped>

> 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].

What about:

Collection>>removeAll: aCollection
  self isEmpty
    ifFalse: [self assert: [self ~~ aCollection].
             aCollection do: [:each | self remove: each]].
  ^ aCollection

Would also be a shortcut for removing some - potentially huge - collection
from an already emptied one...

Greetings,

Stephan

> 
> (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. ;)
> 
> 
> 


-- 
Stephan Rudlof (sr at evolgo.de)
   "Genius doesn't work on an assembly line basis.
    You can't simply say, 'Today I will be brilliant.'"
    -- Kirk, "The Ultimate Computer", stardate 4731.3




More information about the Squeak-dev mailing list