This question is just a musing, a "shower thought" if you will.<p>I have a JS/Python/Java background (side projects can be much lower level though such as C++ or x86-64 ;-) ). I'm currently learning Go from Learn Go With Tests [1]. And I sometimes make silly mistakes such as testAdder instead of TestAdder (lowercase t vs capital T). In that example I got back "testing: warning: no tests to run". I had to use a search engine to find out why. I don't find it a big deal, but I am simply wondering if there is a more efficient way to deal with this problem of understanding "cryptic" error messages when you're starting out in a new language.<p>So, might it be useful to have a site for programmers starting out in a new language that could give potential causes when a particular error message is displayed?<p>[1] <a href="https://quii.gitbook.io/learn-go-with-tests/go-fundamentals/integers" rel="nofollow">https://quii.gitbook.io/learn-go-with-tests/go-fundamentals/...</a>
I've seen a number of things that relate to this:<p>1. a printer troubleshooting site where the only question is "What brand/model of printer do you have?" It suggests the most common problem, and most often it's the rignt answer.<p>2. Sorbet is a static type checker for Ruby that will make suggestions for typo's similar to your example. It also has an autocorrect option, but use with care because sometimes it will choose the closest but completely unrelated name.<p>3. Error messages that are/have clickable links, which take you to a site that has entries from people who got this error and what they found caused and if known fixed it.
The rust compiler does this, and it’s been generally well-received: <a href="https://rustc-dev-guide.rust-lang.org/diagnostics.html#suggestions" rel="nofollow">https://rustc-dev-guide.rust-lang.org/diagnostics.html#sugge...</a>
Inform7 has very educational error messages:<p>(Each time Go or Replay is clicked, Inform tries to translate the source text into a working story, and updates this report.)<p>Problem. The sentence 'This is a book' appears to say two things are the same - I am reading 'This' and 'book' as two different things, and therefore it makes no sense to say that one is the other: it would be like saying that 'John is Paul'. It would be all right if the second thing were the name of a kind, perhaps with properties: for instance 'Abbey Road is a lighted room' says that something called Abbey Road exists and that it is a 'room', which is a kind I know about, combined with a property called 'lighted' which I also know about.<p>Because of this problem, the source could not be translated into a working game. (Correct the source text to remove the difficulty and click on Go once again.)<p><a href="http://inform7.com/" rel="nofollow">http://inform7.com/</a>
Check out the kind of error messaged you get from Elm: <a href="https://elm-lang.org/news/compilers-as-assistants" rel="nofollow">https://elm-lang.org/news/compilers-as-assistants</a><p>In practice, they can be very helpful and clear. But often they are too long, so I end up not reading them.
There is a very cool "explain the exception traceback" package for Python: <a href="https://github.com/aroberge/friendly" rel="nofollow">https://github.com/aroberge/friendly</a><p>See this video for explainer and demo: <a href="https://www.youtube.com/watch?v=TmLnX7opisQ&t=678s" rel="nofollow">https://www.youtube.com/watch?v=TmLnX7opisQ&t=678s</a><p>It's based on case-by-case analysis and recognizers for the most common mistakes:
<a href="https://github.com/aroberge/friendly/blob/master/friendly/runtime_errors/import_error.py#L20-L50" rel="nofollow">https://github.com/aroberge/friendly/blob/master/friendly/ru...</a>
Basically this is the concept of stackoverflow. People (hopefully) post their error messages and then others answer.<p>That being said if it could so easily be answered, then one might wonder why it the computer doesn't fix it for you? I would suggest that there is often sufficient ambiguity about what the programmer desired that the compiler (or other tools) cannot just correct it.
I don't know about other compilers, but in D, the compiler can suggest simple typos, so you'd get something like "Undefined identifier testAdder, did you mean TestAdder?".<p>I think such lists are very useful however. Back when I used C++, Parashift C++ FAQ <a href="https://www.parashift.com/c++-faq/" rel="nofollow">https://www.parashift.com/c++-faq/</a> was very helpful for me. It helps with trickier parts of C++, for example the "most vexing parse" which doesn't have obvious error messages.
Definitely, whenever I come across informative / helpful error messages I'm able to move faster.<p>There is a nice write up from the creator of Keras about this: <a href="https://blog.keras.io/user-experience-design-for-apis.html" rel="nofollow">https://blog.keras.io/user-experience-design-for-apis.html</a> ...See "3 - Provide helpful feedback to your users."
Some people believe the best place to handle this problem is the compiler or runtime themselves by generating non-cryptic error messages. I believe Raku takes this approach.
The trade off is that sometimes only the highly technical answer can give insight, and the more experienced the developer the more useful the technical answer is.<p>That being said, gcc and clang have started to put in suggestion-like responses. Answers don’t <i>have</i> to be obscure, especially not for obscurity’s sake.<p>But all is not lost. You (or somebody) could write a utility that read the compiler output through a pipe and gave more verbose messages
powershell does this with the suggestions component. The easiest way to trigger it is to try to execute something in the current working directory without the ./