Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Because it simply compiles down and is executed as Javascript. It doesn't (and can't) change anything but the syntax.

Edit: It does add features like pattern matching and list comprehension, and anything can compile down to js, so I guess it is a separate language.



I think the difference between syntax and semantics can be quite blurred sometimes. For example, CoffeeScript embraces the "everything is an expression" philosophy and that's a pretty big difference for me compared to plain JS; it affects the way i write -and think about- code in a much deeper way than using indentation instead of braces. So, is the difference between having statements and expressions as different constructs and having only expressions just a syntactic difference?

Another aspect in which CS differs from JS is that it provides built-in classes; which i think can make code written in CS much more consistent compared to JS, where everyone seems to like inventing their own way of writing classes.

And i'm sure i'm forgetting other aspects in which CS differs from JS that i wouldn't consider "just syntactic".


By this logic no language is a real language other than JavaScript, since as we've seen, you can make just about anything "simply compile down" to JavaScript.

Let me put it another way. If I were to write a separate runtime that directly executed CoffeeScript (without JS as an intermediate step), would you then be satisfied that it is in fact a real language?


Now that you say it, and I think about it more, I guess you're right. It does add features like list comprehension and pattern matching, and the compilation really is ambiguous.


Coffeescript doesn't add pattern matching.


Coffeescript has it, though it's formally called destructuring: http://jashkenas.github.com/coffee-script/#destructuring


destructuring assignment is not really pattern matching, as the latter allows flow control and the former does not.





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: