[BUG]Collection>>removeAll:

Andrew C. Greenberg werdna at mucow.com
Thu Aug 29 02:11:03 UTC 2002


On Wednesday, August 28, 2002, at 08:59 PM, Richard A. O'Keefe wrote:

> Stephan Rudlof <sr at evolgo.de> wrote:
> 	I see one real problem here, though: In VisualWorks?
> 	NonCommercial, Release 5i.1 the following does *not* work:
> 	
> 	| coll |
> 	coll := #(1 2 3) asOrderedCollection.
> 	coll removeAll: coll.
> 	coll
> 	
> 	I think compatibility is important just here!
> 	
> Eh?  You think BUG-compatibility is important?
> Look, StarMorph new openInWorld _also_ doesn't work in VisualWorks;
> does that mean we shouldn't let it work in Squeak?

1) The argument presupposes the conclusion that the behavior is a bug; 
many have argued persuasively that it is not; and

2) Compatibility *is* a very important, albeit not overriding, 
consideration.  We don't want to break programs between versions.

> 	Introducing an assertion, which makes the implicit precondition 
> explicit
> 	though, doesn't hurt compatibility.
> 	
> Yes it does.  If (coll removeAll: coll) quietly succeeds in VW
> but reports an error in Squeak, that is even *less* compatible than
> making it produce the right answer.

As at least one of the co-authors of the Smalltalk ANSI standard has 
already written in these letters, this is acceptable precisely because 
the case was not intended to be defined as you have argued, 
notwithstanding the interpretation you impose on the words.  As an 
undefined result, any behavior conforms to an undefined case -- but a 
program relying upon the behavior is not expected to port between 
versions.

This is why David's proposal (trap as an error, by assertion or 
otherwise) seems to be the best heard to date thus far.




More information about the Squeak-dev mailing list