Hacker News new | ask | show | jobs
by Spivak 521 days ago
But it is a boolean value, there's only two possible values TRUE and FALSE. But because it's SQL you can define any column as TYPE | NULL.

You could say that a boolean column with a NULL value is FALSE like how a lot of programming languages coerce it but if you wanted that you would just make a default of FALSE. The meaning of NULL in general being "value not specified" lends itself pretty nicely to "either true or false."

2 comments

What I want is for e.g. "x OR y" where y is NULL (and/or of nullable type) to be an error rather than silently giving surprising results. Just like in a decent programming language I can't do x || y where x and y are of type boolean?, I have to explicitly handle the case where one or other of them is null (or e.g. write x!! || y!! - and that will at still error if either is null rather than silently evaluating to a funny result).
The meaning of NULL in general being "value not specified" lends itself pretty nicely to "either true or false."

You mean neither true or false?

I think I mean either. So yes NULL is a distinct value from true and false so I think it's also right to say it's neither true nor false. But the value NULL does represent is roughly "could be true or false, we don't know yet."
It could mean anything or nothing depending on context, which is part of the problem. (Plenty of people think the meaning of NULL is clear and obvious and consistent, unfortunately they give different answers about what that meaning is)
It could also be neither. It's whatever you define it to be. Null could mean you don't know if it's true or if it's false, or it could mean you know it's neither true nor false.
This is the map territory relation problem.

We bring in the 'Trinity of thought' a priori and forgot about the advantages and costs.

You have the principal of excluded middle, principal of identity, and the principal of non-contradiction.

If your problems territory fits things are convenient.

Once you introduce known, unknown, or unknowable unknowns, the classic model falls down.

Unfortunately you have to choose what to sacrifice based on the context of the problem at hand.

This is exactly where Rice's theorm, the halting problem etc.. arise.

AC from ZF(C) and IID from statistics bring PEM, which gives or forces the classical behavior.

The 'non-trivial' properties of Rice's theorm are exactly those properties where PEM doesn't hold.

The frame problem in machine learning is also related. As is Gödels (in) completeness theories.

Sometimes you can use failure as negation, other times you can use methods like accepting that NULL is an unknown.

But you have to decide what you can sacrifice and still solve real problems.

I think thinking of a problem and it's complement is better.

E.G P is the truthy T and co-P is the truthy F. Obviously P=co-P means that the traditional method works, but jump to NP vs co-NP and ot doesn't.

NP chained ORs, co-NP is chained ANDs is another way of thinking about it.

It could be true or false, but it’s unknown. For example. a user doing a survey is yet to fill in the answer. That doesn’t mean there is no answer, it’s just unrecorded.