3 ms·
So, one of the reasons why people like syntax standardization in the form of formats like s-expressions, JSON, XML, et al. is that the parsers are already there
by buzzybee 10y ago
So, one of the reasons why people like syntax standardization in the form of formats like s-expressions, JSON, XML, et al. is that the parsers are already there and you can just load them in, do some processing, and emit a transformed version.
But when developers go to write their own configuration format they often lean towards a custom syntax so that the end-user, who is expected to be a human being with a text editor, has a more comfortable working environment. And the resulting syntax is write-only, with comments, syntax sugars, etc. that would make it hard to impossible to automate data manipulations and also emit a document that resembled the original.
Tooling like this carves back a mix of both worlds - because it's just operating on the parse tree, it doesn't convey the final meaning of the data as it would be used by the thing being configured, just the "look" of it as a human would read it - but that's still enough to get an automation job done, for most kinds of job.
If you are a developer who wants to ease this job for your own configuration formats, of course, there are plenty of ways to go about this - provide more config formats, or your own extracted parse tree, a scripting API, or the ability to change parameters live. But for pretty much any solution, there is an engineering tax to be paid, and often a new surface area for security risk. So nobody goes about this stuff the same way, and many projects just never really solve it. Hence we end up with a third party like Augeas that comes in to fill the gaps.
My own policy tends to be to start with an XML format and then add a custom syntax to it later as necessary. The initial parsing job becomes straightforward with little chance of catastrophic error, and subsequent custom syntax can emit XML, so you get a twofer on the development time. The downside is basically that XML is a pretty big dependency and nobody is happy with it as a primary UI.