Numbering compiler error messages?

Brad Anderson eco at gnuk.net
Fri Mar 28 10:28:10 PDT 2014


On Friday, 28 March 2014 at 08:25:05 UTC, Johannes Pfau wrote:
> An idea stolen from C#:
>
> How about adding a small 'error-message ID' like DPL00042 to 
> every
> compiler message? This makes it easier to search for 
> information about
> the error. If tools want to handle certain compiler errors then
> they can grep for the message-ID instead of the complete 
> message.
>
> I thought of adding a wiki page, 
> wiki.dlang.org/Compiler_Messages to
> keep a list of all messages. It's then possible to add examples,
> detailed information how to resolve an error and links to 
> further
> information (e.g. changelog entry for error/warning/deprecated 
> message)
> to that page.
>
> I could file a pull request which does this for all existing 
> error
> messages, but it requires contributors to follow a small 
> protocol
> for future error messages as we need to make sure we do not 
> assign one
> ID to different messages:
>
> If you want to introduce a new error message:
> Before even opening a pull request,
> * go to  wiki.dlang.org/Compiler_Messages
> * pick next free ID
> * add it to the page with status pending
> * Once stuff is merged update the description/status on the 
> wiki page
>
> As an example how this could work, search for CS1002.
> So do we want this?

I'm a big fan of CXXXX and LNKXXXX from Visual C++ personally but 
have never brought it up because I know Walter doesn't care for 
them. The quality of error messages in D is a weakness in my 
opinion though so anything to help with that is good in my book.

Thinking aloud here, maybe since DMD is switching to D instead of 
managing IDs they could just be a short hash of the base error 
message. Then a simple program could scan DMD's source and spot 
them all and print out a list which could be compared to the wiki 
list.

Something like this: http://dpaste.dzfl.pl/f552c718e935 (which 
triggers a bug in DMD unfortunately and DMD couldn't use phobos 
anyway).


More information about the Digitalmars-d mailing list