3 ms·
Personally I use textprotos for configuration whenever I can. - Syntax for the configuration is straightforward. - Syntax for the definition is straightforwar
by shaftway 3y ago
Personally I use textprotos for configuration whenever I can.
- Syntax for the configuration is straightforward.
- Syntax for the definition is straightforward.
- It supports comments (end of line and full line).
- It's not NP complete and there is no weird parser meta-language or includes.
- There are parsers for any major language I've used in the last decade.
- It gives me a strongly typed definition so I don't have to infer or parse values.
- It's easy to verify the validity during lint tests by using protoc to encode to a binary proto.
It'd be nice if it supported unicode a bit better, but it's configuration, so that's not a common concern.
- shaftway 3y agoTextproto version of the TOML homepage example that kstrauser's called out: servers { alpha { ip: "10.0.0.1" role: "frontend" } beta { ip: "10.0.0.2" role: "backend" } }
- jiehong 3y agoSadly, list of elements in textproto, being repeated items, appear repeated, which isn’t great.
- tantalor 3y agoCan you expand on that a little, what do you mean exactly?
- audiodude 3y agoLike this grocery_list { fruits: "apple" fruits: "banana" fruits: "pear" }
- xyzzy_plugh 3y agoRepeated fields can use the list syntax: grocery_list { fruits: [ "apple", "banana", "pear" ] }
- MathMonkeyMan 3y agoI've been playing with a lispy thing that might be: (grocery_list (fruit "apple") (fruit "banana") (fruit "pear")) That's pretty much exactly XML. Alternatively: (grocery_list (fruits "apple" "banana" "pear")) but the semantics are different. My motivation is expressing docker-compose.yaml in the "best" way I can imagine, as a design exercise. In that case, I'd rather have a bunch of (service ...) forms, instead of a "services" object. Not sure why. Maybe it's a pun on interpreter-driven formats like that used by [guix][1]. [1]: https://guix.gnu.org/manual/en/html_node/Shepherd-Services.html https://guix.gnu.org/manual/en/html_node/Shepherd-Services.h...
- tantalor 3y ago> That's pretty much exactly XML Haha, what?
- jiehong 3y agoThank you! Didn’t know that!