8 ms·
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.
by augusto2112 7y 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.
- agumonkey 7y agoBut for numbers, a zero is not considered null, because it was handled in the operators rules.
- fhars 7y agoNumerical 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.
- agumonkey 7y agoI think it does
- strictfp 7y agoIt does! It's the numerical "null object", just like the empty string and empty collection.
- reificator 7y ago> 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.
- goatlover 7y agoOr there's NaN which just results in NaN and doesn't equal itself. No need to crash.