cross-posted from: programming.dev/post/1743099
.yaml, .toml, etc?
Submitted 1 year ago by likeaduck@programming.dev to technology@lemmy.world
cross-posted from: programming.dev/post/1743099
.yaml, .toml, etc?
.el (Emacs Lisp), nothing beats using Lisp to configure a Lisp environment.
I toml looks good but it’s rarely used
TOML does look good. Wow! I havent looked at it at all before.
Makes certain levels of nesting painful
You can say this is a design choice, and you shouldn’t ever go too deep in config, and I’d agree, but it is a limiting factor to be aware of
That one which I can automate.
I mainly use Ansible or Puppet. So YAML isn’t that bad if you fully understand it.
Puppet language sux IMHO.
JSON if it also has an online schema, and a reference to it in the JSON file. That way some editors can check for errors and hint to the user about it.
But the good old flat text-data, the ini format is consistent, readable, and easily understandable by less-technical users.
I like xml, but it isn’t the easiest to read.
I hate yaml with a burning passion. At least with JSON you can compress it all down.
We seem to have something in common: there is a serialisation form, we strongly dislike. But what I cannot understand is: why the heck would anyone torture anyone else to read or even write XML? XML is the absolutely worst configuration language I can imagine. I mean: when is something an attribute, when a tag on its own? What is even a list? And don’t forget to include a full HTTP URI for the namespace, otherwise the tag is not defined.
I mainly work with windows, and powershell works great with xml.
I’m no fan of XML. It looks messy and the schema is difficult to write, imo. XML works best as a markup language.
YAML could have been okay if it were stricter with what they consider strings, and used tabs instead of spaces.
Using whitespace was a mistake. I know all the kids love it but it’s just wrong. I’ve never had as much difficulty explaining json or xml to users as I have yaml.
Normal text file
It’s like yaml but simple, consistent, untyped, and you never need to escape any characters, ever.
Types and validation aren’t going to be great unless they’re in the actual code anyway.
For complex configurations, CUE is a very interesting option: cuelang.org
I like how elixir approaches it: configs are just elixir script files that have a module for some common conventions. Gives you a lot of power, and no goofy new syntax
That works if you have a small, disciplined team. As the team grows and it becomes harder to enforce standards, config files that are run through the language compiler easily get filled with programming statements that shouldn’t be in a config file.
Veraxus@kbin.social 1 year ago
If you want the file to be directly human readable/editable:
If you never need to look at it or edit it manually:
vrighter@discuss.tchncs.de 1 year ago
I hate yaml with a passion. for stuff such as ansible it becomes an uneditable mess (one copy and paste away from destroying the whole file)
luckily, yaml is a superset of json, so you could just write json and feed it through a yaml parser and it’ll work