2 ms·
I like the way null is handled in Java, I think it’s pretty well thought out, other than the small awkwardness with basic types. Contrast that with SQL, which
by exabrial 3y ago
I like the way null is handled in Java, I think it’s pretty well thought out, other than the small awkwardness with basic types.
Contrast that with SQL, which had my external scorn for null != null
So you can do WHERE table.col = Null…. Ugh
- dehrmann 3y ago> I like the way null is handled in Java, I think it’s pretty well thought out, other than the small awkwardness with basic types. It's all inherited from C. Null works the same, references are just pointers, and primitives have to be boxed since collections store references. Not sure if I'd say it's well thought out, but coming from C, all the weirdness makes sense.
- jraph 3y ago> Contrast that with SQL, which had my external scorn for null != null For anyone not familiar, or who doesn't know the reason null behave like this in SQL: in this word, null essentially means "don't know". So you can't assume a = b when a and b are null. They could be different values, just that we don't have them. This thing being called null, where null has another semantic in the languages from which we send SQL request is confusing, and I suspect many of us would prefer null behave the same way as everywhere else.
- Akronymus 3y agoSQL is one of the very few places where I deem null to be valid (altough, you could normalize all nulls away, most of the time it isn't worth it) The null != null thing is something I quite like, as it simplifies a lot of joins/queries. and as jraph said, null in relational databases has a very different meaning than null in most programming languages. Don't know vs not assigned