5 ms·
> On the surface it sounds a lot like it would produce error messages like “expected ‘;’” that most beginner programmers come to hate Do people really come to
by thaumasiotes 7y ago
> On the surface it sounds a lot like it would produce error messages like “expected ‘;’” that most beginner programmers come to hate
Do people really come to hate these? I'd expect the opposite -- that people would start off hating messages like "expected ';'", but fairly quickly become accustomed to what they almost always mean.
As long as you can look at the message and have a good idea of what's wrong, it's not a bad message.
- saagarjha 7y agoThe issue is that the solution to errors like these is often not adding a semicolon, but something else like “the compiler has no idea what is going on in this line” and the actual problem can range from something like an unbalanced delimiter, a misspelled keyword, or even a “syntactically valid-looking” (that a stupid parser, like a code highlighter or formatter, would approve of) but ultimately subtly illegal construct. With practice is usually becomes fairly easy to figure out where the actual error is, but it’s certainly not a very good experience for beginners. (And they’ll “come to hate it” because they’ll see it more than a few times before understanding how to deal with them.)
- dottedmag 7y agoPascal grammar is sufficiently different from C-alikes, so it might explain why for Pascal source code these messages are more meaningful.
- m_j_g 7y agoElm has syntax errors stylized in this manner, but I am not sure how much is only rephrasing of usual "expected" or something more elaborate
- nicoburns 7y agoOnce you've used a compiler like Rust or Elm that actually provides suggestions for common solutions to these errors (effectively building the tribal knowledge of what the error "really means" into the compiler itself), it's hard to tolerate these cryptic errors that only really make sense to machines.
- jimhefferon 7y agoI'd like to know more about how they do this. Do you know a good source?
- loeg 7y agoI often found Rust's errors completely confusing, even after chasing down the '--explain CrypticNNNNN' follow-up explainer. This was in 2019 — not some ancient version of Rust.
- saagarjha 7y agoYeah, Rust’s compiler errors are decent if you make simple mistakes but degrade to being about as bad as any other modern compiler’s once you start doing complicated things. Which isn’t horrible, but --explain isn’t really useful so it’s just wasting space on my screen.
- steveklabnik 7y agoPlease file bugs for any message that is confusing! We track them like any other bug, and there’s some folks actively working on them.
- saagarjha 7y agoHmm, I wouldn’t call them confusing per se, they’re just not useful, and I don’t think any compiler has really solved this problem (but then again, generation of compiler error messages is not something I’m an expert in). Let’s say I forgot to put a “*” in front of something: the compiler’s error might be something like “xyz does not implement SomeTrait, here is a page explaining what traits are”. I’d be more than happy to file bugs for things like these but I have generally refrained from doing so because I am unsure if this is something that is possible to fix. If you’d like, I could file issues for things like this, but I’m genuinely curious to hear if there’s any strategies on improving these or work done in this area.
- 7y ago
- projektfu 7y agoThey were frustrating in pascal because of its original ;-as-separator philosophy. Lightspeed/Think pascal would give you those errors and guide you to a compilable program, but it was still too easy to make that mistake in the first place. On the other hand, a missing semicolon in Microsoft C would often give a litany of unrelated errors.
- loeg 7y agoSome versions of GCC, as well (like, mid 2000s 3.x or 4.x).