osa1 github gitlab twitter cv rss

Add a flag to your compiler to print errors in reversed order

September 4, 2016 - Tagged as: en.

About a year ago I opened a feature request for printing error messages in reversed order in GHC. By default most compilers print error messages by sorting them by the line number that they’re originated from. This is good when you get one or two error messages because in that case messages usually fit in the screen. But when you’re middle of a big refactoring (even if it’s just renaming a type) usually what happens is, you make your changes, reload/recompile the code, scroll up for 5 seconds to find the first error, fix it, and repeat.

The reason you scroll up is because most of the time declarations come before uses, and fixing a declaration makes error messages originated from use sites go away.

With a flag that reverses the error message order this becomes much simpler because you don’t need to scroll every time you reload/recompile. So if you’re developing a compiler, please consider adding this to your compiler.

(If you’re a GHC user, this is available with -freverse-errors flag)