-
Notifications
You must be signed in to change notification settings - Fork 49
Description
Hi there,
Coffeescript 2 is getting real: http://coffeescript.org/v2/ (coffeescript6/discuss#80).
It supports many ES2015 features. The reason why I would love to see it in ember is the async/await and generator support. The most important reason though is that the nasty import/export hacks using backticks to write plain JS is not needed any more:
export default Ember.Route.extend
model: ->
@foo()
foo: ->
a = await @bar()
b = await @biz()
"#{a}-#{b}"
bar: ->
new Ember.RSVP.Promise (resolve) ->
setTimeout ->
resolve("baz")
, 2000
biz: ->
new Ember.RSVP.Promise (resolve) ->
setTimeout ->
resolve("biz")
, 2000
I've made a quick test and it is simple to get it running by altering only a few lines of ember-cli-coffeescript and broccoli-coffee:
- update the package.json, remove coffee-script, add coffeescript
- update every require('coffee-script') to require('coffeescript')
But I think this needs more discussion on a meta level, as Coffeescript 1 runs in every browser, but Coffeescript 2 needs transpilation. Thankfully Ember includes Babel, so that is also pretty easy to accomplish:
var app = new EmberApp(defaults, {
'ember-cli-babel': {
includePolyfill: true
}
});
That's the reason why I did not just create pull requests. Maybe new repos should be created, called ember-cli-coffeescript-2 and babel-coffee-2? That would ensure that there is a clear distinction between old Coffeescript (1) and ES2015 Coffeescript (2).
Looking forward to hear your opinions.
BR, toovy