Hats off, wish my package.json and build.yml were package.maml and build.maml.
All config formats are bad. You either don't need all the features at all, except key:value. Or you quickly run into weird limitations and quirks.
What I rather like instead, are custom build english-like DSL's, like:
- https://man.openbsd.org/pf.conf - https://man.openbsd.org/smtpd.conf - https://man.openbsd.org/httpd.conf - … and many more
That’s not an argument against the merits of XML, it’s just a fashion declaration.
It’s also wrong. Podcasting boils down to XML files. It even heavily uses XML’s extension mechanism. XML is the basis for RSS and Atom. XML is the basis for LibreOffice and modern Microsoft Office files. XML is at the core of the epub digital book standard. And on and on.
XML may not be ideal for config (reasonable people can disagree on the topic) but it’s not dead.
It’s also interesting that he declares JSON “won” then adds a bunch of XML features to it like ordered entries and not having to quote element/attribute names.
JSON “won” for web apis - e.g. browser-server data interchange. It is not, and was never claimed to be, good for serial documents like config, or for when you need an extensible format (the “X” in XML). It’s fine for what it is, and so is XML, which, when it “won”, was similarly overused, like for web apis.
I kind of wish it had two and only two features: defined ordering, and comments
As to languages for configuration (specifically), I wish there was a good specification for a program config, where you would have one well-defined configuration file for defaults, and a user-specified configuration file for the values you have set/overriden.
say default.config:
{"player_name":"player", "mouse_speed":5}
and my.config: {"player_name":"me"}
in some way that upgrading the program could do stuff with default.config without destroying your existing config.meh.
RE: Jsonnet and others: because it has nice guarantees, like lack of arbitrary I/O and pure execution.
See: https://sre.google/workbook/configuration-specifics/#pitfall...
It was concise and expressive. There was a direct way to describe variants (types with multiple constructors), which is always awkward in JSON, but the format was still surprisingly low-noise for reading and editing by hand. I remember you could even use it as a lightweight markup format:
(here is some text with (em formatting) information)
(The format leaves the interpretation of things like (em ...) up to you; you could use it as a slightly more verbose Markdown, but you could also use it to structure readable text with other sorts of metadata instead.)And, unlike certain other formats I won't name, it has comments!
It also helps that Emacs with Paredit makes editing s-expressions flow. The tool doesn't need to know anything about the sexplib format specifically; just relying on basic s-expression structure gives us fluid but simple structural editing.
I am constantly sad that nobody else uses this sort of format, and I have to deal with a mixture of JSON, YAML, TOML and other ad-hoc formats instead.
Well typed, simple syntax. Maps are annoying though.
a) textprotos aren't really touted by the protobuf folks as a thing to use outside Google. I'm not 100% sure why this is.
b) inside Google, there's a perception that you shouldn't use textprotos for much other than hardcoding proto values inside the monorepo (where there aren't really schema-versioning concerns). I think this perception is misplaced, you just have to be aware that a given schema is used in textprotos. Which is usually an easy thing to be aware of. This is just because the schema-versioning concerns are different than with binary photos (e.g. field renames are now breaking).
c) IIRC most parsers unconditionally reject unknown fields. I think the reason for this is highlighted in the docs: you can't safely go from a textproto with an unknown field to a binary serialisation of that proto. IIRC there are some parsers that let you parse unknown fields anyway but then I think you're a bit more tied to a specific implementation than you'd like...
One strange but quite handy alternative is actually the JSON representation. You can use .proto files as a schema but then serialise the values to JSON as there's a canonical mapping. Then you get something that's human readable but with the type safety of protos. Although of course it's not really writable since... It's JSON.
That being said TOML would be my choice.
https://ruudvanasseldonk.com/2023/01/11/the-yaml-document-fr...
I would argue that most, if not all, of those problems stem from too many features.
Of course just adding multiline strings is the start of the rabbit hole, now you need to think about leading line breaks, trailing line breaks, intermediate line breaks, whitespace chomping, and- oh heavens I've reinvented YAML, I think I need to lie down.
[1] https://mikehadlow.blogspot.com/2012/05/configuration-comple...
For example, B2B stuff where every customer has their own idiosyncratic sets of rules for if-this-then-that, which change at a different cadence than your releases.
In those cases, it's less that configuration slowly becomes too complex and evolves into code, and more that code is wanted from the get-go but configuration is the compromise.
So Varnish Configuration Language? It's definitely an awkward case that doesn't seem to fit neatly into the landscape.
Here will be a list of ... things I don't like about them.
I did not see a list of things not to like. Just a set of vague thoughtless complaints.* https://www.zytrax.com/books/dns/ch6/#master
* https://bind9.readthedocs.io/en/latest/manpages.html#named-c...
ISC-style? (E/A)BNF-ish?
Personally I like (a) the open/close braces for better stanza navigation, (b) all statements/lines ending with semicolon.
(Something similar was used in (now-EOL) ISC DCHPd, and they've moved to "extended JSON" for their new DHCP server, KEA.)
But since we're criticizing formats ;-) maml https://maml.dev is fairly good good.
* I like multiline blocks and comment style
* I do not like optional commas, either require them or not. I'd lean toward requiring them.
* Not sure about ordered object keys. How should languages represent that, a map/dict kind of a data structure won't work it would have to be an ordered dict/list of kvs etc. Two objects {"a":"x", "b":"y"} and {"b":"y", "a":"x"} will be different then. I get the idea, but I am leaning toward not liking it by the time I finished typing all that.
* I like booleans and null. Good for not having ons and offs those are just annoying.
Programming languages have comments and control flow, multiple popular implementations, and can have nice literals. Lack of Turing completeness is actually not a terribly useful feature if you trust the input (and you should probably just use protobufs or similar for untrusted inputs in that case.)
I do not want control flow of any kind in my configuration file. Nor do I want expressions or any kind of evaluation.
Greppability is a must-have feature for me. As is simplicity - I don’t want to have to deal with internalizing interpreter mechanics, rules for precedence, variable scope, etc just to figure out what config values my program is going to be provided with.
Any time I’ve been forced to work with a system which used a general or restricted programming language to express configuration, it’s been a nightmare.
Which is a way of deciding that makes sense given that I think the purpose of this article is "use my language instead". Getting lost in the weeds about each language's original design intent would bloat the article without meaningfully contributing to their thesis.
The problem is that folks want a flat human readable file format to solve all these problems. That's a pipe dream.
JSON and CSV are pretty close to "syntactically optimal" in terms of losslessly storing nested and tabular data, respectively, in a human readable format. We ought to just stick with those and think about how to design effective configuration systems on top of them.
Need to configure 5 services with hundreds of replicas in 7 data centers? Some values depend on the service, some on the data center and some on the combination thereof? Maybe also overrides for a bunch of problemstic machines?
And you also want a manageable config language which doesn't turn into a full blown Turing tar pit?
Then jsonnet is for you.
So it's not entirely fair to compare it in the "pleasant syntax" contest. It's like putting a Unimog into a ranking of city cars.
My guess is the RPN nature would be a no-go for many people. Nevertheless: comments, dicts, arrays, good string syntax, numerics, binary data, etc. Maybe that makes it too complicated.
theamk•2h ago
At the very bottom, author is presenting its own language (maml.dev). It is yet another JSON with comments, multiline strings, and optional commas. It's the most boring part of the page.
skrebbel•1h ago
XorNot•1h ago
cespare•1h ago
padjo•1h ago
tempest_•1h ago
I have yet to see a solution to that type of thing though as every config language exists on a spectrum of syntax to full blown programing language.
sunrunner•1h ago
Speaking of which, Pkl looks absolutely fascinating, I might have to check that out...
theamk•43m ago
My choice is "whatever is available in the standard library" - which used to be INI, JSON or YAML. But with python 3.11 there is also TOML, which is nice...