Ondřej @certik recently reworked the error reporting in LFortran to be more in line with
rustc. I can’t find whether we had a thread in discourse on this, but here is the relevant issue at the repo: #600.
I was wondering if there is interest to build the tools for
rustc like error messages and diagnostic reports in Fortran and maybe even adopt it for all the major I/O libraries we are developing in the Fortran community? I started exploring an implementation of the
rustc Diagnostic struct for toml-f in GitHub - awvwgk/pretty-diagnostics: Tools to create pretty diagnostic output.
Here is an example report for a duplicated key error created from a stub example (here without color):
error: duplicated key 'title' found --> example.toml:19:2-6 | 1 | # This is a TOML document. 2 | title = "TOML Example" | ----- first defined here 3 | [owner] : 18 | dc = "eqdc10" 19 | [title] | ^^^^^ table 'title' redefined here 20 | data = [ ["gamma", "delta"], [1, 2] ] |
Good tools alone don’t make good error messages, of course. It takes some effort to improve the diagnostic of an I/O library, but it might be worth to take the extra mile. What do you think?