• glibg10b@lemmy.ml
        link
        fedilink
        arrow-up
        6
        ·
        1 year ago

        Some applications don’t have enough config entries to warrant support for nested entries

        Some applications need variable-length data, and some even variable-length lists

        Some applications don’t care about having fast read/write times or a small memory footprint and can do with more complex formats that require the use of third-party libraries

        Some embedded applications (e.g. AVR) don’t have access to a whole lot of libraries

    • Carlos Solís@communities.azkware.net
      link
      fedilink
      English
      arrow-up
      4
      ·
      1 year ago

      Agreed. YAML is a pain to edit manually, to ensure that all the tabulation is correct and the parser does not choke. JSON is passable, but you must be mindful about the brackets. XML is too verbose and duplicative. INI files are just good enough.

      • sugar_in_your_tea
        link
        fedilink
        arrow-up
        6
        ·
        1 year ago

        That’s why I like TOML. It’s basically INI, but it has more structural features if you need them. Most of the TOML files I use look just like ini files.

      • exu@feditown.com
        link
        fedilink
        English
        arrow-up
        3
        ·
        1 year ago

        YAML is fine if you use a formatter. JSON’s ok to read but a pain to write imo. INI if it’s simple.

    • sugar_in_your_tea
      link
      fedilink
      arrow-up
      9
      ·
      1 year ago

      Yup. If I have to pick one for a new project, I’ll go with TOML unless there’s a reason to pick something else. I like that it’s simple, while also having a bunch of features for when the project grows.

      • JackbyDev@programming.dev
        link
        fedilink
        English
        arrow-up
        5
        ·
        1 year ago

        Pretty much same here. With Spring stuff I still use YAML because TOML doesn’t have first class support yet. If TOML is an option I don’t have to go too far out of my way for them I go for it.

        YAML has too many foot guns. It’s still less annoying to read and write than JSON though. Properties files are okay but there doesn’t seem to be an agreed upon spec, so for edge cases it can be confusing.

        • sugar_in_your_tea
          link
          fedilink
          arrow-up
          3
          ·
          edit-2
          1 year ago

          Yup, YAML is a terrible data format, but for a configuration format that you completely control, it works well. Your parser only needs to be good enough to read the configs you create.

          Likewise, JSON is a pretty bad config format due to strictness in the syntax (no optional commas, excessive quotes, etc), but it’s pretty good data format because it’s pretty easy to parse.

          TOML is like YAML, but it has fewer corner cases so it’s pretty easy to learn completely.

          Though anything is superior when it’s already the status quo on a project.

          • JackbyDev@programming.dev
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 year ago

            I don’t know dude, with YAML treating the word no as a Boolean and having like 6 types of multi line strings I’m really inclined to disagree with the “fewer corner cases” part. It’s like waaaaaaaay less corner cases. Imagine pasting the ISO abbreviation for a country as a Boolean value.

  • sugar_in_your_tea
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    How able Lua?

    It’s a programming language, so you can do fancy stuff, or you can just use it as a regular key value file. You can also safely enable/disable features so you only need to allow the subset of Lua that you need.

    It works really well for things like editor configuration (see neovim), and it’s especially nice if you already use Lua as a plugin language or something.

  • Andy@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    https://nestedtext.org/

    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.

  • static_caster@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    1 year ago

    If you use protobuf/gRPC anywhere in your application, text format protobuf. Writes like JSON, but with a clear schema, a parser that already exists in most languages, and has comments.

  • dmoonfire@kbin.social
    link
    fedilink
    arrow-up
    1
    arrow-down
    1
    ·
    1 year ago

    Overall, JSON5 (having comments and end-of-line commas is a big reason I got into YAML).

    I suffer with YAML, but use it pretty heavily. It also has the * and & operators which I use fairly heavily, and it fits well with the Markdown + YAML I use, but I hate that whitespace indenting with a passion.

    Occasionally, I look at Nickle (https://github.com/tweag/nickel) and KDL (https://kdl.dev/) and I get really tempted, just haven’t made that jump.

      • BitSound@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        I like Python and use it a lot, but Dhall has several guarantees that Python doesn’t. If you hand someone clever a Python interpreter, they can and will find a way to run rm -rf / or what-have-you, no matter what safeguards you put in place. Dhall also guarantees that it will terminate, which is pretty useful if you’re embedding it in something else. In Python you could pretty easily accidentally or purposefully get into a while True loop.