Null references redux

Nick Sabalausky a at a.a
Sat Sep 26 23:00:04 PDT 2009


"Walter Bright" <newshound1 at digitalmars.com> wrote in message 
news:h9m33u$in5$1 at digitalmars.com...
>
> Let's say the language is changed so that:
>
>    int i;
>
> is now illegal, and generates a compile time error message. What do you 
> suggest the user do?
>
>    int i = 0;
>
> The compiler now accepts the code. But is 0 the correct value for the 
> program? I guarantee you that programmers will simply insert "= 0" to get 
> it to pass compilation, even if 0 is an invalid value for i for the logic 
> of the program. (I guarantee it because I've seen it over and over, and 
> the bugs that result.)

What? If you admit that's bad behavior (and I agree), then why in the world 
do you have the D complier ***do exactly that***, but just silently?! What 
in the world could possibly be better about the compiler blinding assuming 0 
is ok and tossing it in, versus the programmer blinding assuming 0 is ok and 
tossing it in?!





More information about the Digitalmars-d mailing list