top | item 44190361

(no title)

miav | 9 months ago

The author is not advocating for friendlier messages in the googlesque sense of dumbing them down or introducing more positive wording, but in the sense of making them more readable and useful.

Of course it does not matter for "a straightforward computer error message", in cases where the error is a simple type mismatch or a missed semicolon, but if those were the majority of the problems we encounter as programmers, our work would be trivial.

It's not difficult to imagine a situation where structuring a compiler in such a way that it keeps more state and perhaps has to perform more analysis is worthwhile, since a more useful error message saves the user time in understanding and fixing a problem.

An example that comes to mind is when in Rust I tried to create a dynamically dispatched trait, where the trait in question contained a function an argument of which was generic over a different, statically dispatched trait. Since the compiler did not know at compile time the exact object which would be instantiated, it was incapable of inferring the exact type of the second, statically dispatched trait at compile time, thus failing to compile.

The error was presented to me in a clear way that pointed out the problematic relationship between dispatch types of the two traits allowing me to understand and fix the problem quickly. If the error message was far simpler, such as "can't dynamically dispatch trait", I would have figured that out too, but it would have simply taken more valuable time. Most importantly, having to track down the issue from a minimal error message, would not have been an honorable test of my intelligence and emotional maturity, it simply would have been inefficient.

discuss

order

No comments yet.