logoalt Hacker News

WhyNotHugotoday at 12:11 AM2 repliesview on HN

I wouldn't call KDL "established"; it's honestly pretty niche. It looks _similar_ to pre-existing configuration formats, but KDL is very picky about syntax. I.e.: single word string MUST be quoted.

In this same space, https://codeberg.org/emersion/scfg/ is pretty widely used. The curious thing about scfg is that it's not really a "new" format: the syntax described has been in use by different tools for decades. They just didn't call it scfg, and it's mostly the name itself that's new.


Replies

nickjjtoday at 11:28 AM

It is picky, but picky is good. It's explicit which creates uniformity.

For example with niri, if you forget quotes on a string value, you get this error.

    $ niri validate
    Error:   × error loading config
      ├─▶ error parsing
      ╰─▶ error parsing KDL

    Error:   × identifiers cannot be used as arguments
        ╭─[config.kdl:42:1]
     42 │         // Disable acceleration.
     43 │         accel-profile flat
        ·                       ──┬─
        ·                         ╰── unexpected identifier
     44 │     }
        ╰────
      help: consider enclosing in double quotes ".."
evikstoday at 8:31 AM

> picky about syntax. I.e.: single word string MUST be quoted.

Seems like the opposite:

Example from kdl website without quotes

package { name my-pkg

Example from scfg with quotes

train "Shinkansen" {

show 1 reply