I quite like what has been come up with here. In particular, I understand exactly how HCL would drive someone down this path, as it is infuriating to try to get that language to compute what you want computed.
I think at the end of the day, k8s YAML is focused on the datatype, i.e., what would be the result of your `rcl evaluate`. I do think this would be a much saner path than what Helm provides, though, and Helm's textual templating, as opposed to understanding values and building the actual datastructures, and then converting that to a format like JSON or YAML … is the wrong path. (I.e., I can see RCL being a possible replacement for Helm.)
> The language is a superset of json.
I'm going to introduce what I think is pretty much a universal law: languages claiming to be supersets of other languages are not supersets.
In the case of JSON, there's basically one counter-example that breaks all alleged supersets:
"\ud83d\udca9"
And if we try it:
» printf '"\\ud83d\\udca9"' | cargo r -- evaluate
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/rcl evaluate`
stdin:1:2
╷
1 │ "\ud83d\udca9"
╵ ^~~~~~
Error: Invalid escape sequence: not a Unicode scalar value.
Help: For code points beyond U+FFFF, use '\u{...}' instead of a surrogate pair.
Now! This to me is
not a bug in RCL: this particular facet of JSON is utter
crazy town, and I would strongly encourage you to
not adopt it. (Since down this road lies madness, like unpaired surrogates. JSON's grammar & standard is sloppy here, and JSON/JS's syntax of using the
UTF-16 encoding, and not just the scalar value … it's the part of JavaScript that is just what JS is, but is the part that we shouldn't be copying.)
It is much saner to just have a flag/way to indicate "my input is JSON" and then to just parse it via an actual JSON parser. Then let RCL evolve on its own merits. If there's a lot of happy overlap, and most JSON documents are blissfully polyglots with RCL, that's fine too / a happy little accident. (But the option is important if you want to apply it somewhere programmatically, where the inputs are JSON.)
YAML breaks the same way, too: it too is a "superset" of JSON that isn't.