Improving Compiler Error Messages

Don nospam at nospam.com
Mon May 3 00:56:50 PDT 2010


Walter Bright wrote:
> http://www.drdobbs.com/blog/archives/2010/05/improving_compi.html
> 
> The next dmd update is getting the fruits of this.

Another benefit which you didn't mention in the article is that turning 
bugs into __error in this way makes the compiler simpler and more robust.

If you follow the strategy of guessing what the programmer intended, and 
  ploughing on, you can end up with some very bizarre nonsensical 
situations, which are otherwise impossible. The compiler has to deal 
with that nasty mess.  But, the way to supress cascading errors is by 
short-circuiting semantic analysis.

At least a dozen of the compiler faults which I have patched were caused 
by this. I think a likely side-effect of these changes will be to fix 
bugs which haven't been discovered yet.


More information about the Digitalmars-d mailing list