Null references (oh no, not again!)

Jarrett Billingsley jarrett.billingsley at gmail.com
Tue Mar 3 12:17:58 PST 2009


On Tue, Mar 3, 2009 at 3:08 PM, Denis Koroskin <2korden at gmail.com> wrote:
>
> If nullable is the default and NonNull!(T) has no syntactic sugar, I bet it
> won't be used at all. I know I woudn't, even though I'm one of the biggest
> advocates of introducing non-nullable types in D.
>
> In my opinion, you should teach novices safe practices first, and dangerous
> tricks last. Not vice-versa.

Exactly.  I thought one of the ideas behind D was to have "safe"
defaults.  Yeah, I know, null references can't actually do damage to
your computer because of virtual memory, but neither can concurrent
access to shared data, or accessing uninitialized variables, but
they're taken care of.

If nonnull types were the default, Nullable!(T) would be implementable
as an Algebraic type, just like in Haskell.  One more potential
bragging point ;)



More information about the Digitalmars-d mailing list