[Newbies] Re: Re: How to empty a collection?

cdrick cdrick65 at gmail.com
Tue Feb 19 18:20:02 UTC 2008


> >> >
> >> > Or maybe, if aCollection == self, a warning could be raised ?
> >> >
> >> > What do you think ?
> >>
> >> Thumbs down, I do not want anybody copy a collection behind my back
> >> (however small or large it is) just because remove* has nothing to do
> >> with copy.
> >>
> > Ok, I can understand.
> > What about the error ?
>
> This is a bug, Smalltalk cannot compromise its fundamental structures
> (#removeAll is ANSI). Enter the report if not already on mantis & attach
> your fix.
>

I actually didn't meant it was a bug :) I need to be sharper with
my english... I meant raising an error message if self == aCollection
... Could it be a fix ?

Because in a way, the behavior is not really an error, it's more a bad
use because we know it's iterative and then, self and aCollection
change in the same time...

I hope you don't take my remarks, as "I want to change smalltalk"... I
just want to understand it better ;)

Cheers

Cédrick

ps: by the way, I'll open a bug report, as finally I think it's an
error (arf....) because I shouldn't be aware removeAll is
iterative....etc... so here is the bug report
(http://bugs.squeak.org/view.php?id=6937).


More information about the Beginners mailing list