4 ms·
you got that right, I wish all languages did that,and why not, even suggest modifications to the code in order for it to compile or run... Errors should be an o
by aikah 12y ago
you got that right, I wish all languages did that,and why not, even suggest modifications to the code in order for it to compile or run... Errors should be an opportunity for programmers to learn, it shouldn't feel like a punishment. But we'll get there eventually.
- stormbrew 12y agoObviously not so much for the kind of memory errors the GP is talking about, but clang/clang++ do provide similarly detailed error messages, including suggestions for name-related errors as to what you might have meant (either because a different variable provides the member you specified or becuase of a similarly spelled name).
- frik 12y agoOlder Visual C++ and older gcc gpp had nasty error messages.
- stormbrew 12y agoOlder? They still do. That's why I was specifically talking about clang/clang++.
- pcwalton 12y agoclang was what I based the current Rust compiler's error messages on. Matching its quality was a design goal from the start, since I think that one of the biggest reasons for clang's success was the quality of its error messages. Diagnostics are the UX of a compiler, and so they're deserving of the exact same care that is put into mobile app or Web design.
- stormbrew 12y agoYes, absolutely. I have a theory that a big part of the reason clang leapfrogged g++ so quickly on these things is because it was (initially aiming to) dogfood itself, So getting better error messages than g++ could give was an early and high priority task to its first users.
- evincarofautumn 12y agoI write compilers as a hobby. Providing good error messages is incredibly difficult—the compiler has a ton of information at hand, but it’s hard to know what’s actually useful to present, largely because you can only guess at the programmer’s actual intent.
- amelius 12y ago> It's pretty amazing how detailed and helpful Rust's error messages are. The quality of the error messages is a property of the compiler, not of the language. But of course, a well-designed language also provides the abstractions that ultimately can lead to good error messages.