3 ms·
> If 3-value logic is such a good idea, why doesn't any modern general-purpose language use it? Many languages have a null/undefined of some sort, but they are
by matwood 5y ago
> If 3-value logic is such a good idea, why doesn't any modern general-purpose language use it?
Many languages have a null/undefined of some sort, but they are often simply coerced to false. But, for a language whose sole purpose is to manipulate data the null value nearly always has meaning.
> Given a SQL boolean expression `f(b)` that can return true, false, or null, how do I test if `f(b)` has returned NULL? How do I handle that NULL case?
http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt
Section 8.6, the null predicate.
`where f(b) is null`
> ANSI SQL gives users a strange new paradigm for boolean algebra and then says "GLHF" and gives you zero tools to handle the situation.
It's also not a strange new paradigm, and is in fact built on foundational topics. Relational algebra and set theory are not new concepts.
- Pxtl 5y agoThe term 3-value logic pretty obviously implies the behavior of operators as they relate to NULL, not just the fact that data is nullable, of course. AFAIK MySQL, Oracle, and SQL Server don't have the Boolean datatype as a variable/column type - only Bit, which lacks boolean semnatics, and so Booleans are not considered data values, and therefore can't be used with IS NULL or COALESCE.