From: Neil Watkiss <neilw@ActiveState.com> - 2002-04-23 03:23:58
The YAML spec says that if a document doesn't have document separator, the
following should be assumed:
--- #YAML:1.0 #TAB:NONE
The spec does not specify how a parser should behave if it sees a document
separator without a particular directive:
# Are tabs allowed? What version of the spec is this?
Currently, "---" results in the C parser pretending to see this:
"--- #YAML:1.0 #TAB:NONE"; this should be in the spec, so that other parsers
behave the same way.
In addition, the spec does not specify whether directives are "cumulative" or
whether each document resets to the default. So, for example:
--- #YAML:1.1 ]
A YAML 1.1 document
Is this document also YAML 1.1? Or did it revert back to 1.0?
--- #TAB:8 ]
Tabs are allowed; they're equal to 8 spaces.
Are tabs allowed here?
One benefit of having "cumulative" directives is you don't have to keep
specifying the YAML version on each line. Otherwise once YAML:1.x comes out,
every document will get slightly uglier.
A *major* downside of cumulative directives is that you can't tell just by
looking what semantics apply to a document. So this stream:
is a parse error, but this stream:
# Some unrelated document...
--- #TAB:8 ''
# ... lots more documents
is valid. In other words, the same document is interpreted differently based
on the previous documents. That sucks.
My vote is for the "reset" behaviour. I.e. #TABs only apply to the current
document. This preserves the "cut-n-paste"-ability of YAML, and makes the
parser simpler (it doesn't have to remember the state of previous documents).
I also suggest that emitters require the #YAML:1.0 directive if any other
directives are used. That way if #YAML:2.0 treats the #TAB directive
differently, it is clear (to a human) what version will be used. These issues
all need to be addressed in the spec.