The standard does *not* support - a removeAll: a - [was: Re: [BUG] Collection>>removeAll:]

goran.hultgren at bluefish.se goran.hultgren at bluefish.se
Thu Sep 12 06:24:03 UTC 2002


Hi all!

"Andrew C. Greenberg" <werdna at mucow.com> wrote:
> On Wednesday, September 11, 2002, at 07:31 PM, Lex Spoon wrote:
> 
> > "Richard A. O'Keefe" <ok at cs.otago.ac.nz> wrote:
> > [... inline the assertions, too ...]
> >
> > That's an interesting way to look at the situation, but do note that
> > most Smalltalkers will be suprised to find those assertions or
> > corrections in removeAll:.  Most fooAll: methods just do: on the
> > argument and foo: each element, and have no particular protection
> > against #foo: modifying the argument.

What is this last statement based on? Is it the Squeak image?
Using the MethodFinder and looking at all methods with "all:" I can
actually not find many methods that " just do: on the argument and foo:
each element"...

The only ones I found (a cursory look) where:

Collection>>addAll:
Collection>>removeAll:
CompositeEvent>>addAll:
POSimplePolygon>>addAll:

And I also found that OrderedCollection>>addAll: and
SortedCollection>>addAll: does NOT do that! Of course, what they do is
equivalent to "just do: and foo:" but it is still different code.

Further I found quite a lot of methods named "somethingAll:" but the
only thing I can see that they have in common is that they take an
argument that is intended to be a Collection of something. That is all.

> Which, of course, concedes the point that fooAll: methods entail an 
> implied iteration on its parameter.

Even if the statement was correct (which I do not agree with Lex, at
least not if we look at the image) it would only show that most such
methods where *implemented* that way. IMHO it doesn't "imply" anything.

> Q.E.D.

:-) Nah.

regards, Göran



More information about the Squeak-dev mailing list