TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Would it be educational to map error messages to common mistakes?

32 点作者 melvinroest将近 4 年前
This question is just a musing, a &quot;shower thought&quot; if you will.<p>I have a JS&#x2F;Python&#x2F;Java background (side projects can be much lower level though such as C++ or x86-64 ;-) ). I&#x27;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 &quot;testing: warning: no tests to run&quot;. I had to use a search engine to find out why. I don&#x27;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 &quot;cryptic&quot; error messages when you&#x27;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:&#x2F;&#x2F;quii.gitbook.io&#x2F;learn-go-with-tests&#x2F;go-fundamentals&#x2F;integers" rel="nofollow">https:&#x2F;&#x2F;quii.gitbook.io&#x2F;learn-go-with-tests&#x2F;go-fundamentals&#x2F;...</a>

12 条评论

karmakaze将近 4 年前
I&#x27;ve seen a number of things that relate to this:<p>1. a printer troubleshooting site where the only question is &quot;What brand&#x2F;model of printer do you have?&quot; It suggests the most common problem, and most often it&#x27;s the rignt answer.<p>2. Sorbet is a static type checker for Ruby that will make suggestions for typo&#x27;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&#x2F;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.
评论 #27485555 未加载
brundolf将近 4 年前
The rust compiler does this, and it’s been generally well-received: <a href="https:&#x2F;&#x2F;rustc-dev-guide.rust-lang.org&#x2F;diagnostics.html#suggestions" rel="nofollow">https:&#x2F;&#x2F;rustc-dev-guide.rust-lang.org&#x2F;diagnostics.html#sugge...</a>
indrax将近 4 年前
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 &#x27;This is a book&#x27; appears to say two things are the same - I am reading &#x27;This&#x27; and &#x27;book&#x27; as two different things, and therefore it makes no sense to say that one is the other: it would be like saying that &#x27;John is Paul&#x27;. It would be all right if the second thing were the name of a kind, perhaps with properties: for instance &#x27;Abbey Road is a lighted room&#x27; says that something called Abbey Road exists and that it is a &#x27;room&#x27;, which is a kind I know about, combined with a property called &#x27;lighted&#x27; 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:&#x2F;&#x2F;inform7.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;inform7.com&#x2F;</a>
roetlich将近 4 年前
Check out the kind of error messaged you get from Elm: <a href="https:&#x2F;&#x2F;elm-lang.org&#x2F;news&#x2F;compilers-as-assistants" rel="nofollow">https:&#x2F;&#x2F;elm-lang.org&#x2F;news&#x2F;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.
ivan_ah将近 4 年前
There is a very cool &quot;explain the exception traceback&quot; package for Python: <a href="https:&#x2F;&#x2F;github.com&#x2F;aroberge&#x2F;friendly" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;aroberge&#x2F;friendly</a><p>See this video for explainer and demo: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=TmLnX7opisQ&amp;t=678s" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=TmLnX7opisQ&amp;t=678s</a><p>It&#x27;s based on case-by-case analysis and recognizers for the most common mistakes: <a href="https:&#x2F;&#x2F;github.com&#x2F;aroberge&#x2F;friendly&#x2F;blob&#x2F;master&#x2F;friendly&#x2F;runtime_errors&#x2F;import_error.py#L20-L50" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;aroberge&#x2F;friendly&#x2F;blob&#x2F;master&#x2F;friendly&#x2F;ru...</a>
maerF0x0将近 4 年前
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&#x27;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.
skocznymroczny将近 4 年前
I don&#x27;t know about other compilers, but in D, the compiler can suggest simple typos, so you&#x27;d get something like &quot;Undefined identifier testAdder, did you mean TestAdder?&quot;.<p>I think such lists are very useful however. Back when I used C++, Parashift C++ FAQ <a href="https:&#x2F;&#x2F;www.parashift.com&#x2F;c++-faq&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.parashift.com&#x2F;c++-faq&#x2F;</a> was very helpful for me. It helps with trickier parts of C++, for example the &quot;most vexing parse&quot; which doesn&#x27;t have obvious error messages.
评论 #27502208 未加载
评论 #27490027 未加载
gothungry将近 4 年前
Definitely, whenever I come across informative &#x2F; helpful error messages I&#x27;m able to move faster.<p>There is a nice write up from the creator of Keras about this: <a href="https:&#x2F;&#x2F;blog.keras.io&#x2F;user-experience-design-for-apis.html" rel="nofollow">https:&#x2F;&#x2F;blog.keras.io&#x2F;user-experience-design-for-apis.html</a> ...See &quot;3 - Provide helpful feedback to your users.&quot;
azhenley将近 4 年前
There’s been several dissertations on this topic and a lot of research tools. Compiler errors are [slowly] getting better.
评论 #27486622 未加载
brudgers将近 4 年前
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.
评论 #27540612 未加载
评论 #27473616 未加载
gumby将近 4 年前
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
x0n将近 4 年前
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 .&#x2F;