3 ms·
SQL has true, false, and null, for a good reason. The nil / null value is an attempt to cheaply produce from type T a type like Maybe T, or Optional<T>, or bas
by nine_k 5y ago
SQL has true, false, and null, for a good reason.
The nil / null value is an attempt to cheaply produce from type T a type like Maybe T, or Optional<T>, or basically T | nil. It's sort of practical. OTOH making false and nil indistinguishable is much less convenient than one might think, and leads to subtle errors.
- medstrom 5y agoYou're saying I should use custom symbols like 'true and 'false and put in checks like (eq 'false x) instead of (null x)? To avoid subtle errors? Honest question.
- weavie 5y agoPostmodern (https://quickref.common-lisp.net/postmodern.htm https://quickref.common-lisp.net/postmodern.htm), a library to interface with Postresql will use the keyword `:null` to represent null, and T and nil to represent boolean true and false.
- ajuc 5y agoAnd then SQL implementations use empty string as null :)
- hashkb 5y agoJS has false, null, and undefined... and NaN and 0... and nobody is ever confused.