Struct with default ctor (Was: [dmd-beta] dmd 2.064 beta take 2)
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sun May 19 12:10:28 PDT 2013
On 5/19/13 1:35 PM, deadalnix wrote:
> On Sunday, 19 May 2013 at 13:13:07 UTC, Andrei Alexandrescu wrote:
>> On 5/19/13 9:11 AM, deadalnix wrote:
>>> It is both a race condition and a null problem.
>>
>> No, it's just a race condition.
>>
>>> And having non nullable
>>> type would have been a compile time error instead of days of debugging.
>>
>> No, the race condition would have stayed.
>>
>
> That is ridiculous. non nullable would have made the bug non existent,
> and even without race condition the problem would exists. a reference is
> null, it container shared, then set to something else. You can put
> barriers all over the place to make that sequentially consistent that it
> wouldn't change anything and the bug would still arise.
No, your argument is ridiculous. You make a yarn with precious little
detail that describes for everything everyone knows a textbook race
condition, essentially ask that you are taking by your word that
non-null would miraculously solve it, and, to add insult to injury, and
when we don't buy it, you put the burden of proof on us. This is quite a
trick, my hat is off to you.
> You also never provided any convincing solution to the safety hole.
What's the safety hole? Objects of large static size?
> We
> can't even add check only on some edges cases as D also have values
> types. The only solution we are left with that is really safe is to null
> check every dereference or give up on @safe.
How about using NonNull. We won't change the language at this point to
make non-nullable references by default. Even you acknowledged that
that's not practical. So now you contradict your own affirmation. What
exactly do you sustain, and what are you asking for?
> I encourage you to look at this :
> http://www.infoq.com/presentations/Null-References-The-Billion-Dollar-Mistake-Tony-Hoare
I read it. I don't buy it. Yeah, it's a point, but it's largely
exaggerated for dramatic purposes.
> Most new languages removed nullable by default, or limited its uses
> (scala for instance, allow for null for limited scope).
So what do you realistically think we should do, seeing that we're
aiming at stability?
> I once again want to get attention on the fact that GC change everything
> in regard to reference, and that the C++ situation is a bad example.
I don't understand this.
Andrei
More information about the Digitalmars-d
mailing list