[article] Language Design Deal Breakers

Walter Bright newshound2 at digitalmars.com
Sun May 26 00:25:12 PDT 2013


On 5/25/2013 11:20 PM, deadalnix wrote:
> On Sunday, 26 May 2013 at 06:12:55 UTC, Walter Bright wrote:
>> On 5/25/2013 10:58 PM, deadalnix wrote:
>>> Most ICE in DMD are cause by assert fail on null pointers.
>>
>> Even if that were true (and it isn't), it doesn't follow that having
>> non-nullable pointers would have magically prevented them.
>>
>
> It would have enforced at compile time that all cases are handled.

No, it would not. The flow of data in the compiler is not A=>B=>C, it's a 
complicated graph full of complicated cycles. There is often no place that is 
"this is the node that dominates all the other nodes and also has all the 
information needed to make the pointer non-null."


>> Practically none of them were "oops, I forgot to initialize the pointer",
>> which you'll see if you examine the corresponding pull requests to fix them.
>>
>> The symptom and the cause are two entirely different things. You cannot fix
>> jaundice with makeup.
>
> True, it is simply the consequence of some rare code path that aren't defined
> properly and as they are rare, don't show up in testing. Statically enforcing
> null checking would make theses path apparent, and force the developer to
> consider them.

I don't believe that. Not that there has never been an "I forgot to initialize 
the pointer" bug, there have been. What there hasn't been is a major pile of 
them, they have not been a significant source of dmd bugs.


> It obviously won't provide a solution out of the box to apply. Simply make all
> issues explicit.

I've been analogously slowly making dmd's code const-correct. While this is nice 
for self-documentation, and worth doing for that alone, it hasn't uncovered a 
single actual bug.



More information about the Digitalmars-d mailing list