[BUG] ?? in True and False
Bill Spight
bspight at pacbell.net
Fri Mar 14 02:44:59 UTC 2003
Dear Richard,
Thank you for your full and meaty response. :-)
> Given the way that the compiler open-codes #or: and #and:, it could be
> quite costly to "fix" #and: and #or:.
Since #and: and #or: do not promise to evaluate their arguments, the
fact that they do not determine whether they are Booleans or not does
not seem like a bug. If you do not evaluate them, how do you know? That
is why I confined my remarks to & and |.
And, as far as I can tell by looking at the method code, & and | do not
live up to that promise, anyway. Shouldn't they?
----
True>>& alternativeObject
"Evaluating conjunction -- answer alternativeObject since receiver is
true."
^alternativeObject
----
False>>& alternativeObject
"Evaluating conjunction -- answer false since receiver is false."
^self
----
True>>| aBoolean
"Evaluating disjunction (OR) -- answer true since the receiver is
true."
^self
----
False>>| aBoolean
"Evaluating disjunction (OR) -- answer with the argument, aBoolean."
^aBoolean
----
Thanks,
Bill
More information about the Squeak-dev
mailing list
|