On Tuesday, 20 March 2018 at 23:45:20 UTC, H. S. Teoh wrote:
The tricky part is, who's going to do the work of going through *all* of dmd's error messages and rewriting them with said metadata.
We did it for the stupid syntax highlighting thing... and this has bigger win, though it is also more work than just adding `` around it.
It would seem to me that a solution that can be implemented gradually is more likely to be adopted.
The beauty of XML is that it is reasonably easy to do gradually since it is a marked up string rather than a whole new format. On the display side, it can even detect if(str[0] == '<') assume it is xml, otherwise assume it is plain text. User-side ides can do it as well as the compiler's top-level presentation layer. Or the existing error() function can add "<error>" and encode the stuff, and a new detailedError function does more detail.
xml is also extensible to add more info later when we decide. It really is quite elegant for marking up a text base with more metadata...
E.g. if we can somehow work with the existing format of error messages and extract some useful info from them, perhaps reformat substrings that match certain known patterns, then we can gradually migrate all error messages to a particular format that will eventually serve as the intermediate metadata encoding.
Well, a lot of info is lost by the toChars not putting out as much info as it could. So working with existing messages still needs changes on the generation side to improve it. But we can add info as we go.