Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
KDL: A small document language with node semantics (kdl.dev)
1 point by xpe 5 months ago | hide | past | favorite | 2 comments


I recently came across KDL when searching for a data language that makes it easy to compactly write out a structured document. It seems likely it isn't widely known about, at least among general HN readers, so I wanted to share it.

If you haven't seen it before, you might be tempted to think "how is this different than e.g. JSON?", but I suggest it will make more sense if you think about it as "XML without the baggage".

The most recent top-level mention on HN I found is here: https://news.ycombinator.com/item?id=37249430


Even if you don't use KDL, you might enjoy seeing its use of "slashdash comments" -- this is a great idea to steal if you ever write your own language! [1]

    package
      name my-pkg
      version "1.2.3"

      // ... rest of example at https://kdl.dev

      // "Slashdash" comments operate at the node level,
      // with just `/-`.
      /-this-is-commented {
        this entire node {
          is gone
        }
      }
    }
KDL v2 spec : slashdash comments: https://github.com/kdl-org/kdl/blob/main/draft-marchan-kdl2....

[1] Other languages have it -- this first one that comes to mind is Clojure which allows commenting out of an expression with `#_` (a reader macro): https://clojure.org/reference/reader#_dispatch




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: