null [re: spec#]

Nick Sabalausky a at a.a
Sun Nov 7 22:34:01 PST 2010


"Nick Sabalausky" <a at a.a> wrote in message 
news:ib84bo$1vcn$1 at digitalmars.com...
> "so" <so at so.do> wrote in message news:op.vltk19pq7dtt59 at so-pc...
>> 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.
>
> Yes, and that is *exactly* why I've been saying the compiler should 
> *track* whether or not something has been inited and then bitch when it's 
> used without ebing inited, instead of just blindly tossing a '0' (or null, 
> or NaN) in there with absolutely no knowledge whatsoever as to whether or 
> not it actually *should* be starting out at  '0' (or null, or NaN).
>
>> 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.
>>
>
> Uhh, yea, but what the hell does that have to do with what I said?
>

I think I figured out what you meant. When I said "C# got it right", you 
thought I was talking about how C# doesn't allow any "int x = void;" 
whatsoever, right? That's not what I meant. I was talking about how C# 
issues a compile-time error whenever a variable is read before it's 
guaranteed to have been written (at least for local vars, I don't remember 
how it handles member vars).





More information about the Digitalmars-d mailing list