1. 25


  1. 6

    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”).

    1. 3

      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.

      1. 1

        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?

        1. 2

          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.

      2. 1

        I’ll still prefer Dhall. I like types and I like having functions.

      3. 6

        Lua actually makes a great data description language.

        1. 2

          Thanks for the tip!

          1. 1

            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.)

            1. 1

              Or starlak! I really enjoy writing configuration files in starlark that I then serialize to yaml/json/protobuf

            2. 5

              Consider: https://kdl.dev/

              1. 2

                The syntax can be a little weird

                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:

                object {
                	(foo)array 1 2 {
                		object bar=3
                	(baz)- 4