Null references redux
language_fan
foo at bar.com.invalid
Sat Sep 26 17:05:29 PDT 2009
Sat, 26 Sep 2009 15:49:06 -0700, Walter Bright thusly wrote:
> I used to work at Boeing designing critical flight systems. Absolutely
> the WRONG failure mode is to pretend nothing went wrong and happily
> return default values and show lovely green lights on the instrument
> panel.
Basically if there is only one way the system can operate correctly, your
approach is to catch errors on runtime (segfaults) until a later
iteration of the program development turns out to work correctly or well
enough. Meanwhile there are several buggy revisions of the program in the
development process.
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.
More information about the Digitalmars-d
mailing list