Thanks, I believe Fortran is a very expressive language when it comes to high-level programming. With the right abstraction, even string processing can become beautifully simple in Fortran. In fact the motivation for this tutorial was to show how effortless it is to create high-quality terminal output with the new context object and a linter is a perfect application for creating many of such outputs.
The format chosen is inspired by the Rust compiler, I think it does a great job to present the message for humans and I don’t see a good reason to change it. The intermediary diagnostic object however is meant for machine consumption and could be turned into something which is easy to parse for an external plugin.
That’s not really in scope of this tutorial, but on scope for TOML Fortran for sure. If there is a preferred format to dump such diagnostics, let me know and we can figure out how to integrate this with the context object.
Indeed, schema support would be useful. But this is certainly out-of-scope for TOML Fortran since the library only provides a low level interface to the TOML data structures as well as a set of convenience wrappers to manipulate the structures (get_value
and set_value
, I tend to call those build interfaces).
Schema support should be provided by a separate project building on top of TOML Fortran, especially if JSON Schema is consumed for this purpose we would first need a JSON Schema implementation in Fortran. I started writing something like this a while ago, but didn’t get around to finish it yet.
TOML Fortran is compliant to the TOML standard version 1.0.0, except for the UTF8 support, so no extensions to the format at all. toml-f.git
is a dotted key, which implicitly creates the table toml-f
to insert the git
key. Personally I think it is more expressive than using an inline table (curly braces).
I was actually thinking about adding a linter pass to flag inline tables with a single key to replace them with a dotted key, but I couldn’t think of a good highlighting for this case yet. Maybe something like this:
❯ fpm run -- fpm.toml
info: Inline table with single key should use dotted key
--> fpm.toml:4:10-51
|
4 | toml-f = {git = "https://github.com/toml-f/toml-f"}
| ^--- use dotted key instead ^
|