4 ms·
https://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
by networked 3y ago
https://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.