r/coffeescript • • Mar 25 '15

Why CSON? Why not YAML?

Why did we create yet another data format, CSON? Why not use YAML?

6 Upvotes

8 comments sorted by

View all comments

Show parent comment

1

u/Klathmon Mar 26 '15

Well coffeescript is generally compiled to JS once then just run as JS.

a YAML parser is generally run at runtime and has to load and parse the YAML every time.

1

u/pygy_ Mar 27 '15

The thing is, CSON files are not compiled to JSON (unless maybe you have a custom build step).

CSON.parse calls the CoffeeScript parser at runtime and then checks the AST to verify that only the valid subset is used.