Just where has this language gone wrong?

Damian damianday at hotmail.co.uk
Thu Jul 19 18:35:26 PDT 2012


On Thursday, 19 July 2012 at 22:32:04 UTC, David Piepgrass wrote:
>> I suspect that you have a C++ background. If this is not 
>> accurate, ignore the rest. But if it is accurate, my plea to 
>> you is: Learn other languages. C++ has next to no innovative 
>> language features (even C++11's take on lambdas is an 
>> abomination) and encourages defensive programming to the point 
>> where it's ridiculous (I mean, no default initialization of 
>> variables? In 2012?).
>
> Actually, C# has no default initialization* of local variables, 
> and I love it. Instead, it is a compile-time error to read a 
> variable if the compiler cannot guarantee that you have 
> initialized it. IMO this is much better than D's "let's 
> initialize doubles to NaN so that something fishy will happen 
> at runtime if you forget to initialize it" :)
>
> * technically the compiler asks the runtime to bitwise 0-fill 
> everything, but that's just an implementation detail required 
> for the .NET verifier, and the optimizer can ignore the request 
> to preinitialize.

It would be great if D did do this, surely it would not be all
that difficult! and wouldn't it also help in finding unused 
variables?


More information about the Digitalmars-d mailing list