cue
cue copied to clipboard
fix empty yaml unmarshal
Fixes #1790. This assumes that any time an evaluator returns nil
, but no error, it is simply evaluating an empty value and returns a Bottom.
I think this one is subtle enough that we want @mpvl's eyes on it :)
We looked at this one with @mpvl; we definitely agree that the bug is valid, but we think the fix probably belongs in the encoding package rather than the evaluator. It's also not a trivial fix, because the YAML spec doesn't clearly define whether the empty input should be invalid, null
, or something else. I'll take a deeper look when I can.
I don't think there's a good answer for this. The YAML spec is very vague and implementations don't even seem to have agreement.
https://github.com/nodeca/js-yaml/issues/565
Some of the YAML spec seems to suggest that a completely empty document, or even a document just consisting of comments should not be represented at all.
https://yaml.org/spec/1.2.2/#rule-l-bare-document
Then, an explicit document denoted with ---
should be represented as null.
https://yaml.org/spec/1.2.2/#915-directives-documents
I guess based on that, a bottom (_|_
) value may be appropriate? I guess it then begs the question of what {}
would mean and whether it would better?