| Given the "..." document terminator view, I don't understand why the spec
| says "To ease the task of concatenating YAML streams, the end marker may
| be repeated". Is it so that yaml files can just be joined with "..."
| How would this help given that all documents but the first need to be
| explicit documents with the leading "---" anyway?
We actually messed this part up and are trying to recover.
What we should have done was to have just a single seperator that signifies the end of a document, and allow it to be repeated. This would mean you could always concatenate any two YAML streams by doing first + seperator + second, without having to examine the content of either. If the first ended with a seperator, no harm done. If it wasn't, well there is one now and all is well. This is the reasoning behind allowing '...' to be repeated.
The problem is we began with a document start indicator '---' instead of a document end indicator and bolted the '...' into the spec later on. When concatenating two streams, one must ensure the second one begins with a '---', and the '...' is optional anyway.
What I'd love to do is to change the current spec to make '---' optional, but requiring either '...' or
'---' (or both) to be present to seperate two documents in a stream. This would seem to resolve the issue in
a backward-compatible way and allow for trivial concatenation of YAML streams. It would be more complex than the simplest possible way (above), but such is the proce if compatibility :-(
Clark, care to mull this over a bit and tell us what you think of this? It is backward-compatible so we don;t need to go
1.2 if we do it.
| The repeating "..." rule seems to burden the stream iterator, which
| may need to remember that it's in a between document Interzone.
| Not that keeping such a bit of state around is difficult, just
| potentially unnecessary.
Having a document interzone may prove useful (
e.g., Clark's example of using YAML in IRC). That said, it is a side effect rathar than an intended feature. The intent was to allow trivial manipulation of YAML streams without having to peek inside them.
| # comment, does this produce a null document?
| # does it count as the first document making the next implicit invalid?
This is a syntax error. A document must contain _something_ (can't be a "completely empty node"). If you want a "null" document you must provide a '---'.
This is a single document. Under the current rules, if you want to concatenate it with the previous (invalid) one, you need to add a '---'. So again, syntax error.
| # comment, does *this* produce a null document?
Nope. The spec is clear on this.
| %YAML 1.1 # legal if "---" is next but not '...'?
Finally a valid document. Yes, if you use directives you must end them with a '---'.
I'm in Israel for the summer months. I know I should have merged the results of the last debates and the many fixes people sent into the spec... I didn't have the time. I'll try to get to it in the next 1-2 weekends...