[BUG]Collection>>removeAll:

Valloud Andres Andres.Valloud at oya.state.or.us
Wed Aug 28 20:25:23 UTC 2002


Hello.

> x\x and xUx were relevant to what the final state of the receiver should
be; the point is that a state equivalent to those should be reached.

When you write x in x\x or xUx, you don't refer to the actual set, you refer
to a definition.  You can refer to a definition because you wrote something
like

	x = {e | e has some property}
	y = {e1, ..., en}

In fact, the "result" of expressions like x\y is not a set.  It is a
definition, because that's how \ was defined:

	x\y = {e | e in x AND e not in y}

Named "sets" are just shorthands for their definitions, in the same way in
which x\y and xUy are shorthands for the definitions they imply.

In the particular case x\x, we obtain a definition equivalent to that of the
empty set.  We don't get the empty set, or remove elements from x, or
anything like that.

There's no math set operation that mutates sets --- of course, because set
theory is about the controlled manufacture of definitions.  In fact, you can
have set theory by playing boolean algebra with the definitions of sets.  In
some sense, "sets" themselves don't even need to exist for you to have a set
theory because a set is just the collection of all objects which satisfy the
definition --- which you may or may not be interested in.

Smalltalk's collections, on the other hand, are not implemented around
definitions: they're the actual elements.  That's why x\x makes sense in set
theory and x removeAll: x doesn't make sense in Smalltalk.

Note how there are none of these issues with non-mutating messages
(circularities excluded).

A definition of an object *IS NOT* the object.

Andres.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020828/fdaf8765/attachment.htm


More information about the Squeak-dev mailing list