3 ms·
I love critiques of SQL about implementations of NULL. "NULL is so special that it's not equal to anything, not even itself!" Like, duh. WTF should NULL be equ
by ianamartin 6y ago
I love critiques of SQL about implementations of NULL. "NULL is so special that it's not equal to anything, not even itself!"
Like, duh. WTF should NULL be equal to?
Anytime I see people making this kind of argument about "doing better than SQL" I can immediately tell they are pretty much fucked in the head.
Good luck, edgedb peeps. You haven't got a clue.
- ArchD 6y agoMaybe if you introduce the concept of a mathematically-principled empty set, you can do away the unprincipled concept of NULL. Empty set equals empty set.
- ianamartin 6y agoNull isn't empty set.
- MaxBarraclough 6y ago> WTF should NULL be equal to? In programming languages, NULL tends to be equal to itself. Why couldn't it be the same way in SQL?
- ianamartin 6y agoNo. That is not even close to being true. You're confusing None with NULL, like everyone else. Only a very few programming languages make this error. NULL is undefined. It can't be equal or unequal to anything, including itself, for reasons that should be obvious.
- MaxBarraclough 6y ago> That is not even close to being true. In C, NULL is equal to itself. In C++, nullptr is equal to itself. In Java, null is equal to itself. Same in C#. In JavaScript, null is equal to itself, and so is undefined. > You're confusing None with NULL, like everyone else. Only a very few programming languages make this error. Not so, as I've just shown. SQL takes the philosophy that NULL isn't a value, but a marker for the absence of a value, and gives it special treatment so that it is not treated as equal to itself. Most programming languages do not take this approach, they instead treat null as a special value, special in that dereferencing it is disallowed, but it's still subject to the usual comparison rules (i.e. it's equal to itself). Your contrasting of None again NULL isn't meaningful. They're just words. The semantics depend on the language. > NULL is undefined Depends on the language. In C it's defined as 0, roughly speaking. (Curiously the bit-pattern used to represent NULL is not required to be zero. [0]) As a curious aside, in C, the special float value NaN is not equal to itself. [0] https://stackoverflow.com/a/9894047/ https://stackoverflow.com/a/9894047/
- ianamartin 6y agoI am so completely unsurprised that people who don't understand the concept of undefined are telling me that it's actually defined.