James Miller:

> If you have a possible null, then check for it *yourself* sometimes
> you know its null, sometimes you don't have any control. However, the
> compiler has no way of knowing that. Its basically an all-or-nothing
> thing with the compiler.

In a normal program there are many situations where the programmer knows a 
class reference or a pointer can't be null. If the type system of the language 
allows you to write down this semantic information with some kind of 
annotation, and the compiler is able to analyze the code a bit to make that 
correct and handy, some null-related bugs don't happen. And this costs nothing 
at run-time (but maybe it increases the compilation time a bit).


> I'm not sure what the fuss is here, we cannot demand that every little
> convenience be packed into D, at some point we need to face facts that
> we are still programming, and sometimes things go wrong.

I agree. On the other hand null-related bugs are common enough and bad enough 
that improving their management in some way (helping avoid them, helping their 
debug) is more than just a little convenience.


> If you have a specific need for extreme safety and no sharp corners,
> use Java, or some other VM language, PHP comes to mind as well.

PHP is not at the top of the list of the languages for people that want 
"extreme safety".

Bye,
bearophile

Reply via email to