On 1/17/2014 4:17 PM, Andrei Alexandrescu wrote:
On 1/17/14 3:37 PM, Walter Bright wrote:
Come on. Every type in D has a default initializer. There's still
nothing special about null.
There is. Null pointers cause the process to finish.
This particular subthread is about finding the reason why there was a null, not
about what happens when the invalid value is detected.
Even if you got rid of all the nulls and instead use the null object
pattern, you're not going to find it any easier to track it down, and
you're in even worse shape because now it can fail and you may not even
detect the failure, or may discover the error much, much further from
the source of the bug.
How do you know all that?
Because I've tracked down the cause of many, many null pointers, and I've
tracked down the cause of many, many other kinds of invalid values in a
variable. Null pointers tend to get detected much sooner, hence closer to where
they were set.