Null references redux

language_fan foo at bar.com.invalid
Sun Sep 27 10:01:11 PDT 2009


Sun, 27 Sep 2009 16:47:51 +0000, Jesse Phillips thusly wrote:

> The thing is that memory safety is the only safety with code. In
> Walter's examples he very clearly showed that a crash is not unsafe, but
> operating with incorrect values is. He has pointed out that if
> initialization is enforced, whether with a default or by coder, there is
> a good chance it will be initialized to the wrong value.

Have you ever used functional languages? When you develop in Haskell or 
SML, how often you feel there is a good change something will be 
initialized to the wrong value? Can you show some statistics that show 
how unsafe this practice is?

When the non-nullability is made optional, you *only* use it when you 
really know the initialization has a sane value, ok? Otherwise you can 
use the good old nullable references, right?


> Now if you really want to throw some sticks into the spokes, you would
> say that if the program crashes due to a null pointer, it is still
> likely that the programmer will just initialize/set the value to a
> "default" that still isn't valid just to get the program to continue to
> run.

Why should it crash in the first place? I hate crashes. You liek them? I 
can prove by structural induction that you do not like them when you can 
avoid crashes with static checking.



More information about the Digitalmars-d mailing list