Closed hildjj closed 9 years ago
Some other specification definition examples for other structured data:
Another example: RFC7159
I'd suggest that there are two paths.
Of these, I think I prefer (1), but not by much.
http://coffeescript.org/#objects_and_arrays
Maybe this goes beyond just CSON, but CoffeeScript definition in general.
Experience from JSON tends to indicate that divorcing CSON from coffee-script as soon as possible is going to allow much better interop between CSON implementations written in different languages. If coffee-script needs a more formal definition, that's an unrelated issue. The language at http://coffeescript.org/#objects_and_arrays is a good starting point, of course.
Fixed in v2 - there is now cson-parser package
Although I agree that splitting out the parser code into a separate module that doesn't re-use the coffee-script parser was fantastic work, I think you may be missing the point of the documentation request. Defining CSON as a wire-level protocol (where the "wire" might include a file, for example) is necessary if I want to write an implementation in a language that doesn't share ECMAscript's odd notion of Unicode (UTF-16 plus naked surrogates with escape sequences that might or might not generate valid Unicode when parsed?), have different notions of numbers (e.g. real 64-bit integers), has floating point types that work, etc. Saying "it's just coffee-script, and therefore just ECMAscript" doesn't make these questions go away. Am I allowed to include functions? Can I include function calls? What about using "import"?
No dynamic abilities. They are for coffee files. CSON is now just a data format. Further discussion should happen over at https://github.com/groupon/cson-parser see https://github.com/bevry/cson/issues/33 also
JSON suffered from being too tied to the JavaScript programming language early on. I suggest a document describing the format being parsed, so that other interoperable implementations can be built.
If this exists already, than I suggest a link in the README. If it doesn't, I'd be willing to take a first stab at text.