Three Value Logic

John M McIntosh johnmci at smalltalkconsulting.com
Thu Dec 9 03:55:58 UTC 1999


> Hi
> 
> I'm doing some coding which requires a three value logic (true/false/unknown).
>

Hi, many years ago I worked with a 4GL that support this, however it was
true, false, null. Some interesting things happened because.

true & null -> null
false & null -> null
false = null -> null

null ifTrue -> nope
null ifFalse -> yes!

thus
value ifTrue: []
    ifFalse: [foo]

would invoke the ifFalse block foo if false, or null..
This of course caused some issues when the vendor shoehorned the support in
their VM without careful consideration, mostly when some poor programmer set
a Boolean to null. It didn't help any when they added SQL support and mapped
SQL boolean to true,false,null. All you needed then was a cross table join
where null was an acceptable answer.

This of course doesn't answer your question, but be careful about control
statements that are binary in logic.

--
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================
Custom Macintosh programming & various Smalltalk dialects
PGP Key: DSS/Diff/46FC3BE6
Fingerprint=B22F 7D67 92B7 5D52 72D7  E94A EE69 2D21 46FC 3BE6
===========================================================================





More information about the Squeak-dev mailing list