On Sun, 30 Mar 2014 15:23:44 -0400, Walter Bright <[email protected]> wrote:

On 3/30/2014 4:04 AM, Paulo Pinto wrote:
Am 28.03.2014 19:09, schrieb Walter Bright:
On 3/28/2014 2:23 AM, monarch_dodra wrote:
Well, I'm just throwing that out there.

I've thought many times that an error message should be a clickable
link. But until console displays support clickable text, it's just a
fantasy.

Actually on GNU/Linux systems many do.

I just tried it on Ubuntu and - you're right! Pretty awesome.

Yes, I think a url, even if not clickable, is way more useful than an arbitrary error id. It takes not much effort to copy/paste a URL into a browser.

We can make this easy:

Compiler outputs a URL like this: http://derror.org/2.065/filename.c/l123

Using a function that takes __FILE__ and __LINE__

Then, include a special comment just before the error output that will be parsed by a post-processor, and link that url to the comment (either in github, or on a nice web page).

Example:

const char *errurl(const char *file = __FILE__, int line = __LINE__); // does this work in C++? I can't remember!

// <ERRMSG> A variable cannot be re-defined inside a new scope. See http://dlang.org/...
error("is shadowing declaration %s%s", s->toPrettyChars(), errurl());

errurl could be configured to print a URL or nothing via a command line option.

Bonus: those who know the error url format know exactly where to go in the code to see where it was printed from.

-Steve

Reply via email to