On Tue, Dec 11, 2001 at 07:31:44AM -0800, Brian Ingerson wrote:
| On 11/12/01 09:19 -0500, Clark C . Evans wrote:
| > If we are willing to deal with another syntax-shorthand,
| > I'd rather assign the following...
| > ---
| > key = value
| > to mean...
| > ---
| > |: key
| > =: value
| You've completely lost me. How is this a "short-hand"?
When the parser encounteres "tag =" it reports
a mapping with two keys. A name key, and a
value key. The name key would be the scalar
value "tag" and the value key would be what ever
followed the equal sign, or what ever is on the
next line indented appropriately.
Oren wants a nice way to write a "named list"
as what is found in XML. Given the following,
He proposed that this could be written as...
- p: first paragraph
- b: world
which would be equivalent to...
p: first paragraph
So, I call his proposal a "syntax short-hand", beacuse
it is yet another way to express mapping.
The problem with Oren's suggestion is that it
doesn't handle XML attributes.
I think a better way to write this is...
In this way, XML is loaded into YAML via a recursive
map/seq structure where the tag name is keyed by "|"
(or any other special key, your choice) and the tag's
value is "=".
Problem with the above, is that it isn't all that
pretty to look at (in text). Although, it does
make alot of sense via the native interface.
So, I was proposing syntax sugar for this
use-case (for XML mapping) so that the item above
could be written:
- p =
- b = paragraph!
In other words, those mappings that have only two
keys (= and |) could be given a nicer syntax.
What character we use for the tag name doesn't
matter (|), it could just as easily be @.
The advantage of this proposal over Oren's proposal
is that it handles XML attributes. The disadvantage
is that it is a syntax-rewrite.
Let's just drop it... if someone wants to represent
XML as characters, let them use... XML! Nothing
saying we can't make a simple XML2YAML converter