3 ms·
The author disputes that logically there is no such thing as a Null value. > I disagreed with the statement in the post that: >> Logically-speaking, there is
by bjpbakker 8y ago
The author disputes that logically there is no such thing as a Null value.
> I disagreed with the statement in the post that:
>> Logically-speaking, there is no such thing as Null
> [..]
> Boolean logic
> [..]
> It isn’t true [..] it isn’t false either. We need another value, that means “this cannot be decided given the current state of our knowledge”.
Null as used by many computer languages is not some logical choice. As in the example, sometimes a value has possibly more choices than just True | False. Logically-speaking that means the value has three choices: True | False | Undecided.
Some computer languages let you encode this more convenient that others. Even falling back to Null to represent the possibility isn't necessarily bad. However, that doesn't make Null a logical thing, but just the representation of this choice for a computer.
- mjburgess 8y ago>However, that doesn't make Null a logical thing, but just the representation of this choice for a computer. In that sense, "True" as encoded in programming languages isn't a "logical thing" either. Programming languages are their own domain of syntax/semantics, which can encode other domains (eg. mathematics). The type, Trivalent = { True, False, Null } is a perfectly reasonable encoding of a system of logic.
- Y_Y 8y agoenum Bool { True, False, FileNotFound };
- skywhopper 8y agoThe bit about logic was mostly in response to the previous article that argued that we shouldn't use Null because logic doesn't have Null. But that's not true. This author is ultimately making the point you are making, which is that there's a concept that every programming language has to grapple with. Some call it Null. Some use more formalized means.