null [re: spec#]

so so at so.do
Sun Nov 7 13:38:23 PST 2010


On Sun, 07 Nov 2010 22:41:41 +0200, Nick Sabalausky <a at a.a> wrote:

> "so" <so at so.do> wrote in message news:op.vls71ytk7dtt59 at so-pc...
>>> On a related note, I *hate* that D silently sticks in a default value
>>> whenever anything isn't properly inited. This is one thing where I  
>>> really
>>> think C# got it right, and D got it wrong. And waving the "It's not
>>> leaving
>>> it with an undefined value like C does!" banner is an irritating
>>> strawman:
>>> Yea, it's better than C, but it still sucks.
>>
>> This is one of the times (and this doesn't happen rarely) i am glad  
>> Walter
>> is the head of D.
>> It is total BS i am sorry can put it in a polite way.
>>
>
> How is it total BS?

If a language is able to avoid bugs caused by uninitialized variables, it  
should.
But when it comes to a system language you have to preserve the rights of  
those
that know initialization is very expensive/or just plain unnecessary at  
some point, and want compiler to ignore it.
"something a = void;" is a very elegant solution, and it is explicit, you  
have best of both worlds.

You could have just argued about that explicit initialization should be a  
must, that would make sense in another language but D way is much better.
You have both explicit initialization and default initialization since you  
know "int i" is "int i=0" at the instant you are typeing, same goes for  
reader of your code.

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d mailing list