Spec#, nullables and more
Walter Bright
newshound2 at digitalmars.com
Fri Nov 5 13:44:58 PDT 2010
bearophile wrote:
> Walter, instead of poking and teasing me as a ten year old does, why we don't
> start talking about serious things? Like, for example if we want nonnull
> references/pointers in D3. If you aren't interested in this feature we can
> stop wasting my time. It's not a necessary feature, I will keep using D2 even
> without it. But it may be something nice to have.
I've explained my position and rationale on null many, many times here.
tl;dr: null serves the same role as the NaN does for floating point types. It
means an invalid value (not an uninitialized value). Invalid values are highly
useful as bug detectors (usually mistaken for being a bug). I wish there were a
NaN value we could use for integers. Without a null, one is reduced to having to
craft a default value that throws exceptions when accessed, ending up in the
same place.
To eliminate null pointers is the same as shooting the canary in your coal mine
because its twitter annoys you.
More information about the Digitalmars-d
mailing list