3 ms·
KDL: A small document language with node semantics
- xpe 1y agoI 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 https://news.ycombinator.com/item?id=37249430
- xpe 1y agoEven 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.md#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 https://clojure.org/reference/reader#_dispatch