3 ms·
>> Logically-speaking, there is no such thing as Null (...) Oh but there is. The author is probably considering only propositional calculi with two truth valu
by YeGoblynQueenne 9y ago
>> Logically-speaking, there is no such thing as Null (...)
Oh but there is.
The author is probably considering only propositional calculi with two truth values, such as Boolean algebra and, er, well, they're probably only considering Boolean algebra because that's what we use in computers, because it maps nicely to 0s and 1s.
However, two-valued logics are by no means the only possible logics, neither are they the only ones that have actually been described in the framework of mathematical logic. Probably the most well-known many-valued logics are Łukasiewicz's and Kleene's that have three truth values (i.e. values assigned to literals): true, false ...and unknown.
... which is to say, "null".
And just to blow your mind, there are also infinite-valued logics, like fuzzy logic and, I'd argue, the good old probability calculus of the reverend Bayes, which is nothing if not a many-valued logic.
The mistake is, I think, that the author is taking "logic" to mean Aristotelian logic, however that is not at all the logic we use in computers. Like I say above, computers use Boolean algebra which is an entirely different formal system with its own axioms, separate to grandpa Aristotle's own. For instance- Aristotle never said anything about functions, mappings from the set of literals to {0,1}, neither did he formally define the algebra of the Boolean operators AND, OR and NOT (a.k.a. conjunction, disjunction and negation). Although you can project Aristotelian logic onto Boolean logic, they are far from the same and I would really struggle to see how one would implement a programmable computer using Aristotelian logic.
P.S. Am I mansplaining now? Wouldn't that be a little ...weird?
- WkndTriathlete 9y ago>> Kleene's that have three truth values (i.e. values assigned to literals): true, false ...and unknown. ... which is to say, "null". Regardless of what logics exist the statement you make - that "unknown" is "null" - is actually wrong and the heart of the problem. "Unknown" is only one semantic interpretation of null; there are many others, and problems arise in software development because of those (sometimes slight) differences in the interpretation of what "null" should reflect in the real world. Some sources suggest as many as 129 possible semantic meanings for "null", which is why Date rails against "null" values in SQL. With Option/Maybe we're constrained to the universe of values of that type plus exactly one more value (None); with null who knows how many of the 129 possible meanings of the null value we are dealing with in addition to the base type? Null is computationally and mentally expensive to deal with.
- zeth___ 9y agoThe same is true for true and false. What meaning gets attached to Boolean values is immaterial to how they act. That null is implemented oddly doesn't negate the fact it's a meaningful and well defined mathematical construct. I don't see people saying false doesn't exist because forth implements it as -1.
- YeGoblynQueenne 9y agoThis. Edit: removed unnecessary blablah.
- AnimalMuppet 9y agoBut how many of those 129 possible meanings for null are possible meanings for None in an Option type? And if you're going to say "only one", I'd suggest that you go through the list of 129 possible meanings for null very carefully to be sure...