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

Andrew C. Greenberg werdna at mucow.com
Mon Sep 2 10:37:09 UTC 2002


On Monday, September 2, 2002, at 03:39 AM, Richard A. O'Keefe wrote:

> I also claim that
>
>     oldElements copy do: [:each | self remove: each]
>
> implemenents precisely the semantics required by the ANSI standard.
> "each element of oldElements" is visited; the text says nothing about
> sending any enumeration message to oldElements itself.

Except on collections where it doesn't: Richard's reasonable code 
presumes that the collection answers to copy in the manner expected.

This code fails, for example, on a LinkedList.




More information about the Squeak-dev mailing list