yaml / YAML2

An Effort to Revitalize the YAML Project and Community
43 stars 5 forks source link

Support EMCAScript style comments. #3

Open trans opened 12 years ago

trans commented 12 years ago

In order to ensure a proper subset of JSON5, I don't think there is any choice but to also support // and /* ... */ style comments. I really hate this b/c I really hate that style of comment. I asked EMCAScript developers to add support for # style comments in turn for future version so it wouldn't be so bad, but they they weren't too enthused, to say the least. Apparently they have big plans to introduce # as a literal notation for prototypeless "tuples" and "records".

Of course, this may not matter if JSON5 never gains traction, but it is something to be prepared for. So I think it is a good idea to consider it. Could the YAML spec handle these two comment notations ok?

trans commented 8 years ago

There is another reason that it might be a good idea. As Markdown has become the defacto markup standard, strings that start with # become common place, which bares more careful consideration when emitting or writing YAML that contains it. // is at least a bit less likely to be an issue.

shoogle commented 5 years ago

In order to ensure a proper subset of JSON5

"JSON5" is just another JSON extension/alternative like jsonc or CSON. It is not "the 5th version of JSON" as you might expect.

JSON5 is not related to JSON in an official sense, though this is not at all obvious from their website. They use all sorts of official-sounding language, talking about EMCA standards, etc. and they even go as far as listing Douglas Crockford (creator of JSON) in the credits along with all the people who helped out on JSON5. It's only when you look closely that you realise they are just thanking him for the original JSON and JSON parser, not for anything specifically to do with JSON5. This seem rather misleading. In their defense, it seems there was another project before them called JSON3 that was also not affiliated to official JSON. But that was just a library rather than a new "standard".