Live data from Hacker News

The KDL Document Language

kdl.dev

21–30 of 64 posts

Re: The KDL Document Language

#21

I have no idea what people are complaining about in this thread. I find projects like this genius. I love making programming languages and I hate hate hate writing parsers, yet I enjoy experimenting with different syntax. Stuff like this is very convenient because you can just import your code as document, use path language to extract data, and schema language to apply basic checks. Not only is this thing standardize…

When my projects are posted publicly, I like attaboys, but I need constructive criticism. Asking pointed questions and questioning purported inconsistencies is not complaining.

Re: The KDL Document Language

#22

I have no idea what people are complaining about in this thread. I find projects like this genius. I love making programming languages and I hate hate hate writing parsers, yet I enjoy experimenting with different syntax. Stuff like this is very convenient because you can just import your code as document, use path language to extract data, and schema language to apply basic checks. Not only is this thing standardize…

When my projects are posted publicly, I like attaboys, but I need constructive criticism. Asking pointed questions and questioning purported inconsistencies is not complaining.

Criticism given by those that do not align with the core goals/userbase of a project is not constructive. Giving criticism on something you don't intend to/wouldn't use is just complaining.

Re: The KDL Document Language

#24
I have pretty much no interest in another markup language (or whatever we're calling these sorts of things today[1]) but I really want the slashdash comment style in every language I use now, that's an incredible idea.

[1] apparently I didn't edit this in fast enough but wow I have even less interest in semantic arguments about what is and isn't a markup language.

Re: The KDL Document Language

#25
post #20

Earlier quoted context omitted.

This isn't meant to replace HTML. I see it as a better language for configs. JSON lacks comments. YAML also has problems: https://noyaml.com/

The very first example is a document with metadata like title, author, etc. It's called a "document language". It seems to be straddling documents and configuration, which in my experience makes for a lot of awkwardness. This part seems to be a symptom of that: There are two specifications for writing KDL that can be losslessly translated between it and JSON or XML. These specifications define a stricter subset of KD…

  > The very first example is a document with metadata like title, author, etc. It's called a "document language".
Static sites generators often have content in markdown, but I also saw quite some use of YAML or JSON.

  > It seems to be straddling documents and configuration, which in my experience makes for a lot of awkwardness.
It seems to be for structured data, that can be both a document of some sorts or a configuration; just like YAML/JSON/XML is used for both.

  > There are two specifications for writing KDL that can be losslessly translated between it and JSON or XML.
  > These specifications define a stricter subset of KDL that, even if NOT entirely idiomatic, is still valid and fits into the data models of the other two languages: (emphasis mine)

Note that the author means two separate, additional specifications about how to losslessly translate (iow. convert) between KDL and JSON or XML, not that the actual KDL spec has provisions for reading JSON/XML as KDL. I mean, FWICT some JSON file may parse though, but it's not like YAML, which is an actual superset of JSON; now _that_ adds awkwardness.

One can also create a spec to transform JSON into XML, that does not mean it has anything directly to do with the XML spec.

I rather see this as effort to make it easier to switch to KDL, if one finds its characteristics nice(r).

Re: The KDL Document Language

#26

I have pretty much no interest in another markup language (or whatever we're calling these sorts of things today[1]) but I really want the slashdash comment style in every language I use now, that's an incredible idea. [1] apparently I didn't edit this in fast enough but wow I have even less interest in semantic arguments about what is and isn't a markup language.

The author specifically mentions at the end that they do not mean KDL to be a markup language:

> Finally, KDL is not a markup language. XML or HTML do a much better job of "marking up" a text document with special tags, although KDL can still be useful for templating engines that want to be more strict about text fragments.

Re: The KDL Document Language

#27
Looks interesting enough to put it on my "to evaluate/play-around" pile.

I'd be interested to know what the author thinks about RON[0], it's not quite the same but also has some nice properties and wants to be a replacement for JSON (yes this is more one for XML or JSON, but still).

Sometimes I wonder if all those formats would never have got invented if JSON had just allowed comments and trailing commas in the first place. While there's JSON5[1] now, it just has not the same level of native (ecosystem) support as JSON has.

[0]: https://github.com/ron-rs/ron

[1]: https://json5.org/

Re: The KDL Document Language

#28
Go for it KDL, I really want a better standard for this. Anyone with some dev experience has done the XML => Json => Yaml => “screw it I’ll do my own” cycle.

It’s painful to go through.

Re: The KDL Document Language

#29

Hmm... Not really sure I get what problem this schema is the best solution for. It seems like the author was more interested in implementing a model they felt was more conceptually sound than other solutions, but aren't solving any significant problems, and don't seem to have any big functional improvements over more established contenders. Just going through the section for why they think it beats YAML: > YAML can b…

> That sounds like a poorly designed configuration setup. If you've got a nested config that complex, by my reckoning, it should be reorganized into flatter data structures or broken down into more specific configuration files regardless of what the format is.

YAML isn’t just for config. It’s also a serialization format. If your internal data structures are deeply-nested, then the YAML serialization of them will also (properly) be deeply-nested.

Sometimes you need to hand-edit some data in a multi-megabyte YAML-serialized file. It’s possible, but it’s kind of awful. Editing a multi-megabyte KDL-serialized file sounds like it might be slightly less awful.

(Maybe I’m weird, but I see this format as being close to a textual analog of https://en.wikipedia.org/wiki/Interchange_File_Format, as used/inherited by file formats like AIFF, PNG, etc. Maybe picturing a PNG file or the like encoded in this format might make it clearer what the author is going for?)

Re: The KDL Document Language

#30
They mention xml quite early but bury how you’d do markup inside a text. Basically you can’t do it, but there is a convention to work around it.

> If the element contains mixed text and element children, the text can be encoded as a KDL node with the name - with a single string unnamed argument. For example, the XML

    some bold text 
> can be encoded as

    span { - "some "; b "bold"; - " text" }.
Post reply on HN