Another new idiom for conditional testing?

Andres Valloud sqrmax at prodigy.net
Tue Oct 2 15:41:56 UTC 2001


Hi.

I think this could look even better:

aBlock, anotherBlock, yetAnotherBlock ifAllTrue:... "n-ary and"
aBlock, anotherBlock, yetAnotherBlock ifAllFalse:... "n-ary and"
aBlock, anotherBlock, yetAnotherBlock ifAnyTrue:... "n-ary or"
aBlock, anotherBlock, yetAnotherBlock ifAnyFalse:... "n-ary or"

where BlockContext>>, is

, aBlock

	^BlockContextComposite with: self with: aBlock

And where BlockContextComposite is subclass of, say, Boolean (!... but
it looks ok).  BlockContextComposite would also implement #,.

The "bad" part is that true and false have to respond to the new
messages so that true, false and the block context aggregates become
exchangeable.  However, these messages reduce themselves to applications
of existing messages in the case of true/false, so they can be
implemented once only once in Boolean.

What do you think?

Andres.




More information about the Squeak-dev mailing list