From: Kirill S. <xi...@ga...> - 2010-08-25 14:59:01
|
On 08/25/2010 04:03 AM, Andrey Somov wrote: > I still do not understand why we do not follow the spec: > > 1) {a:1} -> {"a:1": null} (yes, it is not intuitive, but according to the spec) > 2) {url: http://dot.com} -> "url": "http://dot.com" > > I think it is better to implement p.1 instead of the current failure > because we can give a chance to a user to fix the problem at runtime. > > >> I strongly disagreed with it because it does not follow Python or Javascript conventions, >> but I didn't want to decide one way or another until some consensus is reached. >> So I made ':' (colon followed by a non-whitespace character) an error when it is a part of a plain literal in the flow context. > > People agree on the specification exactly to avoid personal flavors. I just treated these issues as bugs in the spec. > For instance I totally disagree to have 18 (!!!) possible alternatives > for a boolean value but nevertheless I had to implement them all. > SnakeYAML does not fail on 'Yes'. (even though I am sure it should be > just !!str) Yet you may notice that YAML 1.2 spec reduced them to: true | True | TRUE | false | False | FALSE And now we have a problem with compatibility: how could we move to 1.2 without breaking user's YAML data. Had we followed the common sense in this case, it would be much better for everyone. > Since 1.2 specification did not make any change about a colon on the > flow context I feel it is better to follow the spec. I think that this > is the indication that the consensus is reached. You are wrong about the 1.2 spec not changing interpretation of a colon in the flow context; it is now much closer to what PyYAML does, and exactly for the same reasons: compatibility. In 1.1: {"a":"b"} -> error In 1.2 (and PyYAML): {"a":"b"} -> {"a": "b"} Thanks, Kirill |