Null references redux
Walter Bright
newshound1 at digitalmars.com
Sat Sep 26 18:20:28 PDT 2009
language_fan wrote:
> The idea behind non-nullable types and other contracts is to catch these
> errors on compile time. Sure, the code is a bit harder to write, but it
> is safe and never segfaults. The idea is to minimize the amount of
> runtime errors of all sorts. That's also how other features of statically
> typed languages work.
I certainly agree that catching errors at compile time is preferable by
far. Where I disagree is the notion that non-nullable types achieve
this. I've argued extensively here that they hide errors, not fix them.
Also, by "safe" I presume you mean "memory safe" which means free of
memory corruption. Null pointer exceptions are memory safe. A null
pointer could be caused by memory corruption, but it cannot *cause*
memory corruption.
More information about the Digitalmars-d
mailing list