I am once again reminding you of the existence of (, a fancy new config/document language that could make your config files so much more expressive and maintainable than YAML/JSON. pls take a look!

There's parsers for a bunch of languages now, including a really nice format-preserving parser for Rust that I released a short while ago:

anyway the world's on fire but thinking about KDL made me smile again, so I'm sharing this anyway instead of making my TL all about the Big Bad News.

imagine if your GitHub Action configs could look like this. Indentation wouldn't be an issue, and you could easily auto-format the entire file. No weird string ambiguities either!

or consider it perhaps as a cleaner alternative with XML (with which it shares its main semantics):

@zkat mmm mmm. Cool. We are about to implement GitHub actions on our projects.

@cr1901 not just comments, it has *slashdash* (/-) comments, which are _structural_ comments, instead of line-based:

@zkat Holy shit this just blew my mind. I went from never ever having had this idea straight to "why does not every languages do this??"

@piegames it's based on a similar construct in Common Lisp, actually! It's not completely original!

@piegames in CL, you can do #+nil(foo 1 2 3) to comment out individual expressions.

@zkat I've always used // and /* comments to distinguish between code comments and commented out code. (and wished they had more built in semantics around that concept) /- comments are a way superior method to achieve the same goal.

@zkat Realistically, I'm stalling working on something I don't want to work on.

But I finally caved and wrote my own build system (err ninja generator) and am thinking of using KDL as the config file that becomes a ninja file.

@cr1901 that'd be awesome! I'm excited to see what that looks like :)

@zkat I really love that for replacing MSBuild files... XML is just so annoyingly verbose for that application.

@zkat I like this very much. Does KDL already have a serde crate? :blobnomcookie:

@rafael A proper serde crate is in development:

But if you just need "works like serde", then knuffel is probably better because it's more geared towards KDL semantics:

@zkat nice, thank you! Amazing work here! :blobcatheart: I will consider using this at work to replace some huge JSON files we have to edit manually… :blobcatsip:

@orta ohai orta!! nice to see you 'round these parts! And thank you :)

How possible would it to build a transpiler for this? You could then write your CI configs with KDL and "compile" them into YAML, JSON or whatever format your CI accepts. I think that would be cool!

@heikkiket one for a specific purpose? Easy. A generalized one? Hard.

It’s very very easy to convert kdl<->xml

The same is not true for yaml and json. They have different semantics

@ariadne CUE looks like a schema/validation language for validating JSON/yaml? That's pretty much completely orthogonal to KDL itself (which doesn't even have JSON/YAML semantics)

@ionizedgirl yes! Well, mine and several others at this point :)


> I am not interested in having first-class date types,

wise decision

@zkat it looks pretty cool I will try it out next time I reach for a config language

@zkat One weird weekend hack I've been playing with is a small cmdline tool that looks for a `context.kdl` file with environment variables, conda environments, etc and applies those when cd'ing into a directory. Basically `.env` files taken to their logical extreme...

@zkat thanks for the reminder, last time I tried it, I ended up bouncing off and reverting to JSON mostly because I already had a mental model for what those docs look like.

I found just now after you posted a couple screen shot examples and realized a lot of what I wanted was this. Now I just need to build a language type to document munger in my mental model. Going to try replacing some of my config in my 8-bit repository with kdl again this weekend.

@zkat anyway, just wanna say thanks for building cool stuff, it always challenges my tech mental model. Whether it's config format now or lisp stuff in our early friendship, or all the stuff between. Following your projects has made me a better engineer.

this looks pretty awesome. have you checked out UCL by any chance? i've found it to work quite well for freebsd, and seems to share some of the same concepts you note.

having said that - i'm all for more well thought out config formats that aren't yaml/json/xml :flan_hurrah:

@nomadlogic this looks very strange and inconsistent to me? Also, it doesn't look very different from JSON or YAML to me.

yea i agree that that example does a little odd. i should probably have linked to the github page that is more recent:

i suspect the reason that it certainly does resemble YAML/JSON might be due to it's inherent ability to parse (and emit) those serialization formats.

so maybe it's nothing like what your working on - or the total opposite of your goals 😂​

@nomadlogic yeah you can’t 1:1 convert between kdl and JSON/Yaml unless you follow specific patterns. It’s not meant for that.

@zkat I'm convinced that there should be three types of config languages:
- Basic: StrictYaml (essentially string-only) / ini / .env
- Sophisticated: KDL/etc
- Programmatic: HCL

@kouhai @zkat I tend to just use the programming language I'm already using especially if its interpreted

@kouhai @zkat This is my big annoyance with ansible... like why are you using YAML + Jinja when you're already written in Python...

@zkat oh shoot, this is actually really cool! will definitely try this out for my projects!

Sign in to participate in the conversation

On the internet, everyone knows you're a cat — and that's totally okay.