yamlscript

Ingy döt Net 2024-05-18T00:44:38.601339Z

The YAML core design team met up Berlin a couple weeks ago. We got traction on a new YAML 1.3 spec. It adds a way to specify various extension syntaxes. These extensions can change the YAML grammar structure. This makes it seem very hard to get implementations to implement this (and all the extensions). I'm planning to write the reference implementation in pure Clojure, including the parser layer, then shipping it to all programming language ala YS. So at least one implementation of YAML 1.3 will work in any language (and exactly the same).

Ingy döt Net 2024-05-18T00:46:27.939689Z

For the unfamiliar, even clj-yaml is not pure clojure. It uses the old YAML 1.1 version of SnakeYAML for the parsing layer (and likely the emitting layer rhough I haven't checked).

2024-05-18T11:24:46.234109Z

Could a YAML extension establish a distinct tokenizing/nesting/quoting/escaping scheme, more or less in the same vein as React's quasi-HTML templates embedded-in-JS?

Ingy döt Net 2024-05-18T14:10:43.763849Z

I don't know what you mean by the latter. But yes to the former. One example is that we could allow tab indentation and annotations in a particular YAML document with something like:

%YAML 1.3 +tabs +annotations

Ingy döt Net 2024-05-18T16:48:05.441039Z

Maybe you meant something like:

%YAML 1.3 +interpolation +ypath
---
- &data
  name: world
---
- `Hello *data.name
`

Ingy döt Net 2024-05-18T16:48:25.158199Z

That would be possible...

Ingy döt Net 2024-05-18T16:50:52.372379Z

In YAML 1.2 backticks are reserved, anchors don't span documents, and ypathing doesn't exist. That would be the same situation in 1.3 unless you asked for the extensions and the loader supported them.