From: Oren Ben-K. <or...@be...> - 2006-04-11 16:41:56
|
Hi people, Sorry for the long absence - personal reasons. I hope to get more YAML time from now on. Brian, Clark and myself discussed the JSON compatibility issue. We basically see two options: 1. Only require a space after the ":" if the key is plain. So: "foo":123 # Becomes valid 12:34: Meeting # Stays valid bar: http://yaml.org # Stays valid This is backward compatible, and compatible with machine-generated JSON. It is _not_ compatible with hand written "JSON-like" data like {foo:bar} - JSON insists on quotes, but hand-written data often lacks them. 2. Disallow ":" in plain keys. "foo":123 # Becomes valid 12:34: Meeting # Becomes error bar: http://yaml.org # Stays valid This is not backward compatible, as keys with ":" in them will break. To minimize this, we can specify that the above rule only holds in flow context (inside {}). Presumably all YAML that contains : in keys has it in block context (outside {}). So {12:34: meeting} will be an error but the above example will stay valid. Personally, I feel that (1) is a better way, as it is fully backward compatible and fully JSON compatible. AFAIK the vast majority of JSON is written by machines and not by people, and the JSON spec is clear that " are mandatory so all libraries emit them. I also think that having such a subtle difference between block and flow keys would be too confusing. Finally, option (1) is such a minor relaxation of the spec that I doubt its worth to bump YAML's version number for it. Option (2) is definitely a YAML 1.2 thing, which I feel is an overkill. Brian has been... persuaded... to accept option (1) <grin>, which leaves Clark to get a concensus. Clark? Have fun, Oren Ben-Kiki |