Hacker News new | ask | show | jobs
by augusto2112 2345 days ago
Sometimes you don't want to allow a value to be null at all, but with null references you can't represent that at the language level.
1 comments

But for numbers, a zero is not considered null, because it was handled in the operators rules.
Numerical zero has nothing to do with the issue discussed here. What you are proposing is to add another “number” to types like int and float that results in the program crashing whenever you try to add it to another number.
It does! It's the numerical "null object", just like the empty string and empty collection.
> What you are proposing is to add another “number” to types like int and float that results in the program crashing whenever you try to add it to another number.

There's already division by zero and NaN to trip you up in IEEE754.

Or there's NaN which just results in NaN and doesn't equal itself. No need to crash.
I think it does