I haven’t used TOML much, but it feels like a sane middle ground between the rigidity of JSON syntax (”No trailing commas!” WHACK) and the crazy wild-West of YAML (”It looks like you’re trying to say null here. Fixed it for you”).
It seems to lack the features that are the reason that I like UCL, specifically well-defined composition. UCL defines include semantics with the option to add, replace, or remove nodes from the prior tree. This makes it easy to split configuration into multiple files and provides things like default, overridden by machine-generated files, overridden by human-edited files. You can do the config.d-style thing very easily, including every file in a directory and having each one define a set of nodes that it adds or replaces.
With TOML, as far as I can see, you’re also stuck with a single config file, which is fine for simple programs but very painful for something with large config files. You need to build this on top and that means that you lose the ability to treat the config files as generic.
Yes, although libUCL will let you retrieve an unquoted string that’s also a valid number as either. I use it with a JSON schema, which means that I don’t suffer from that ambiguity.
Historically, I believe that was the purpose Lua was created for.
I kind of prefer there to be a separation between a configuration syntax and a DSL. On the one side, using a full language for configs makes it hard for new users; I just encountered Gulp (based on JS) last week and the config files are quite confusing. On the other hand, shoehorning logic into a config syntax ends up recreating control-flow constructs in ugly ways (viz. CMake, and GitHub Actions YAML.)
Of course, using children for literals is overly-verbose. It’s only necessary when nesting arrays or objects into objects; for example, the JSON object {"foo": [1, 2, {"bar": 3}], "baz":4} can be written in JiK as:
I haven’t used TOML much, but it feels like a sane middle ground between the rigidity of JSON syntax (”No trailing commas!” WHACK) and the crazy wild-West of YAML (”It looks like you’re trying to say
null
here. Fixed it for you”).It seems to lack the features that are the reason that I like UCL, specifically well-defined composition. UCL defines include semantics with the option to add, replace, or remove nodes from the prior tree. This makes it easy to split configuration into multiple files and provides things like default, overridden by machine-generated files, overridden by human-edited files. You can do the
config.d
-style thing very easily, including every file in a directory and having each one define a set of nodes that it adds or replaces.With TOML, as far as I can see, you’re also stuck with a single config file, which is fine for simple programs but very painful for something with large config files. You need to build this on top and that means that you lose the ability to treat the config files as generic.
In UCL doesn’t “no requirement of quotes for strings” result in the same string-vs-number/bool ambiguity that’s such a footgun in YAML?
Yes, although libUCL will let you retrieve an unquoted string that’s also a valid number as either. I use it with a JSON schema, which means that I don’t suffer from that ambiguity.
I’ll still prefer Dhall. I like types and I like having functions.
Lua actually makes a great data description language.
Thanks for the tip!
Historically, I believe that was the purpose Lua was created for.
I kind of prefer there to be a separation between a configuration syntax and a DSL. On the one side, using a full language for configs makes it hard for new users; I just encountered Gulp (based on JS) last week and the config files are quite confusing. On the other hand, shoehorning logic into a config syntax ends up recreating control-flow constructs in ugly ways (viz. CMake, and GitHub Actions YAML.)
Or starlak! I really enjoy writing configuration files in starlark that I then serialize to yaml/json/protobuf
Consider: https://kdl.dev/
The syntax can be a little weird