Null references redux

Rainer Deyke rainerd at eldwood.com
Mon Sep 28 20:04:38 PDT 2009


Jesse Phillips wrote:
> Yeah, it was brought to my attention that "type safety" by a friend
> could be another form. bearophile also brings up a good example.

<snip>

> I think that is what Walter is getting at, you're not dealing with
> memory that is correct, when this happens the program should halt and
> be dealt with from outside the program.

Type errors and null pointer errors both belong to the same class of
errors, namely variables containing bogus contents.  Some languages like
Python detect both at runtime.  That's fine for those languages.
However, I prefer to detect as many errors as possible at compile time,
especially for larger projects.

Nullable types turn compile time errors into runtime errors which may or
may not be detected during testing.  In the worst case, nullable types
lead to silent data corruption.  Consider what happens when a bogus null
field is serialized.


-- 
Rainer Deyke - rainerd at eldwood.com



More information about the Digitalmars-d mailing list