If you don't have a null, then you have to set aside some value for the type as the default value. With null, you get a seg fault if you try and use it.
Without a null, you'll need to create a special default value which performs the same function - giving an error if you try to use it.
Floating point values have NaN for this, UTF-8 code units have 0xFF. The D programming language uses NaN and 0xFF to default initialize these types. NaN is good because it is "sticky", meaning if a result is computed that depended on a NaN, the result is NaN as well.
Some people complain about this, wanting floats to be 0.0 default initialized. But then it would be nearly impossible to tell if an unintended 0.0 crept into the calculation.
> More like "String and null"
Null's replacement, Maybe and Optional, still have the extra check.
Without a null, you'll need to create a special default value which performs the same function - giving an error if you try to use it.
Floating point values have NaN for this, UTF-8 code units have 0xFF. The D programming language uses NaN and 0xFF to default initialize these types. NaN is good because it is "sticky", meaning if a result is computed that depended on a NaN, the result is NaN as well.
Some people complain about this, wanting floats to be 0.0 default initialized. But then it would be nearly impossible to tell if an unintended 0.0 crept into the calculation.
> More like "String and null"
Null's replacement, Maybe and Optional, still have the extra check.