Boolean Expression

A Binary expression that reflects one of two states (I.E. True or False, On or off)

Toss Nulls into it to mess it up, like SQL did.

Well, the meaning of a null is "This represents nothing", so setting a boolean expression to null would mean "this is nothing". Why SQL Invalidate the whole expression? is one of those mysteries of life...

ItDepends. If you consider NULL to mean "nothing" or "unknown", this choice is questionable at least for AND and OR (e.g. "false AND unknown" stays false under any reasonable interpretation of AND). But, if NULL means "failure" or "exception" this information has to be propagated independent of the AND and ORs. It's just a question of interpretation of what NULL means. I think the point really is: NULL is a badly chosen name for it. UNKNOWN for the former interpretation or ERROR for the latter would have been much better. Sidenote: if NULL really is a value like "unknown", it wouldn't be a BooleanExpression any longer, but rather a ThreeValuedLogic expression.

If we keep nulls (debatable), perhaps there should be two kinds of nulls. One kind means "unknown but otherwise assume 'false', zero, or blank", and the other "unknown and propagate as unknown".

Related: BooleanLogic, ExpressionApiComplaints, ThreeValuedLogic


EditText of this page (last edited October 23, 2006) or FindPage with title or text search