# Is it better for Discourse to use JavaScript or CoffeeScript?

**URL:** <https://meta.discourse.org/t/is-it-better-for-discourse-to-use-javascript-or-coffeescript/3153>\
**Category:** Development\
**Created:** [2013年二月15日 13:34 UTC](https://meta.discourse.org/t/is-it-better-for-discourse-to-use-javascript-or-coffeescript/3153 "2013-02-15T13:34:20Z")\
**Posts on this page:** 1\
**Showing post:** 19

<div class="post-metadata">

**Author:** ![wycats](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wycats/32/103867_2.png) [@wycats](https://meta.discourse.org/u/wycats)\
**Post date:** [2013年二月16日 00:38 UTC](https://meta.discourse.org/t/is-it-better-for-discourse-to-use-javascript-or-coffeescript/3153/19 "2013-02-16T00:38:16Z")

</div>

> [@simonlmn](#):
>
> I don’t understand the problem here. Which parts of CoffeeScript require “new syntax” in JavaScript? Isn’t the problem exactly the same if you were using “plain” JavaScript, that at some point in time, if some breaking change occurs in some future version of JavaScript, you would have to change your code?

Actually, this problem could not occur in JavaScript, because ES6+ will always be backwards compatible with the current version of JavaScript. Further, the “1JS” principle means that you will be able to take existing code and opt into new features simply by using the new syntax (there will be no “use es6” pragma or version switch).

The core difference is that ES6 is, by definition and by requirement, a strict superset of current JavaScript. By definition, there can be no new syntax that is incompatible with existing JavaScript.

In contrast, how would CoffeeScript target the new `for/of` loops, when they already have `for/of` loops of their own? Sure, they could add new syntax, but it would be **massively** confusing for `for/of` to target the old semantics, and some other syntax to target ES6 `for/of`.

Similarly, CoffeeScript classes and `super` have subtly different semantics than ES6 classes and `super`. If CoffeeScript started targeting the new semantics, they would break existing code. If they required a different keyword to target ES6 `class`, it would, again, be very confusing.

You could imagine an **incompatible** CoffeeScript 2 that targeted ES6 syntax, but existing CoffeeScript code would not work. Again, this cannot happen in future versions of JavaScript, because new JavaScript features are required not to break existing JavaScript code.

It may be a bit difficult to wrap your mind around the difference, but I assure you, it’s true.

---

_[View the full topic](https://meta.discourse.org/t/is-it-better-for-discourse-to-use-javascript-or-coffeescript/3153)._
