This is the hard, underappreciated work of PL: academics don’t care, and industry people have sufficient Stockholm Syndrome to skip it.
I’m not sure I agree with all of the “I” phrasing of the compiler (“I was expecting a close brace”) but maybe it reads easier than the more-terse error messages to which we’re accustomed to.
Completely. The overall tone (things like “Try putting a } next and see if that helps?”) feels a little condescending to me. But adding contextualisation and remediating steps is a great improvement over the status quo of error messages.
It’s easy to forget these potential quality-of-life improvements that are staring us in the face.
I find the compiler using “I” to be extremely condescending, and the error messages so large that it’s hard to find the information about what’s wrong inside the “friendly” text. In actual use, I have seldom found the suggestions helpful.
This is not to say that we should abandon all colour or information, but I would much prefer something like:
(code with erroneous part highlighted)
Inferred from context: Foo
Actual type provided: Bar
Additional detail etc.
Sadly, Elm is the exact sort of opinionated language where I wouldn’t even bother trying to PR an -i-know-what-i-am-doing-please-be-terse flag for the compiler.
I don’t think trying to be friendly to beginners means being condescending to people who knows what they are doing. If the format of errors is consistent then after the third error you see you will know where to look without having to read everything. And someone that doesn’t know what is going on has more information to understand what’s happening. Tiny inconvenience for experienced developers while making on-boarding vastly easier.
How exactly is compiler personification condescending?
The person who wrote the compiler doesn’t consider me an adult that can read direct output from a tool.
That is quite the stretch.
Immediately jumping to such an uncharitable explanation isn’t healthy.
Having some examples near compile errors is a fun idea.
How long until someone asks for a -i-know-what-i-am-doing-please-be-terse flag to the compiler?
That flag is spelt --error-format short in Rust, but personally, I have never seen anyone using it. People actually like long errors.
What I really like here is how it provides an example of syntactically correct code. It’s a lot easier for people to write correct code when they have something to pattern after. Copy and paste is really helpful!