Jason House wrote:
I've recently convinced myself that nullability should be the exception instead
of the norm. So much of the code I write in C#/D uses reference objects
assuming they're non-null. Only in certain special cases do I handle null
explicitly. The issue is that if any special case is missed/mishandled, it can
spread to other code.
I'm also too lazy to write non-null contracts in D. They also have far less
value since violations are not caught at compile time (or better yet, in my IDE
as I write code).
It may be as simple as having the following 3 types:
T // non-nullable
T? // nullable, safe
T* // nullable, unsafe
I'd also like to remove all default initialization in favor of use of
uninitialized variable errors. Default initialization in D is cute, but it is
not a solution for programmer oversight. Single-threaded code will reproducibly
do the wrong thing, but may be harder to notice in the first place. The very
fact that the signalling nan change has made it into D shows that people want
this type of behavior!
Yes. Default initialization is really week against uninitialized
variables errors. You notice the errors of the first one at runtime, and
the errors of the second one at compile-time.
But I don't see that changing anytime soon... (I think it's because "it
gets hard").