4 ms·
I don't find TOML files easy to read/understand. Especially when I'm scrolling through a file, I encounter myself backtracking to understand again its structur
by aeurielesn 3y ago
I don't find TOML files easy to read/understand.
Especially when I'm scrolling through a file, I encounter myself backtracking to understand again its structure.
- taeric 3y agoSimilarly, I don't find yaml easy to read/understand. XML had the curse of people trying to use every feature possible in most documents. And as much as I do prefer the "program" approach of emacs, I will make no defense of giant emacs config files, either.
- masklinn 3y agoOTOH you can factorise and modularise an emacs config file. Sometimes an XML file if it uses xinclude (though that can be an issue in other ways). yaml? who knows. Whether and how (and the limitations) depends on whoever cooked up that pile.
- marcosdumay 3y agoXML has the problem of too many features. If you personally decides to use them or not doesn't change the fact that whatever software reads it has to support them. XML parsing is also not a pure computation. That said, a XML-lite would quite probably be the best data encoding language one could create right now. It would still suck as a configuration language, as it's a very different problem.
- networked 3y agohttps://kdl.dev/ https://kdl.dev/ is an XML-lite configuration language with a pleasant syntax. It has a neat syntactic feature for commenting things out called "'slashdash' comments". An example from the spec: mynode /-"commented" "not commented" /-key="value" /-{ a b } A problem with a node-based design similar to XML compared to something that parses to nested lists and dictionaries is that you pretty much need a query API. Implementing it takes nontrivial extra work. This affects KDL implementations: KDL specifies a query language, but I think no Python KDL library has implemented it so far. It limits how useful KDL is in Python, despite there being multiple working parsers. Edit: Rephrased the second paragraph.
- marcosdumay 3y agoThat language is very interesting, thank you. But I do disagree on the work. A node-based language parses into a sequence of (name, node_type, data) tuples. What is just as easy to travel as the (name, data) from the data map ones. The thing is, a query language is much more useful for them than for a data map, so it's worthwhile to implement one. (There's probably some cultural aspect here too.)
- networked 3y agoYou're welcome. Yes, you are right. Node-based structures are not meaningfully harder to traverse than nested lists and dictionaries. That was a wrong comparison.
- networked 3y ago> The thing is, a query language is much more useful for them than for a data map, so it's worthwhile to implement one. I agree about this.