|
|
|
|
|
by coroutines
4028 days ago
|
|
In regards to Coffeescript over ES6, I still turn to CF for these: 1) postfix conditionals
2) list comprehensions (will probably be in ES7)
3) the .litcoffee format
4) use of -> or => for defining functions unbound/bound to `this`
5) python-escue whitespace (i love it)
6) array slicing (some_array[3 .. 8])
7) regular expresions defined on several lines (expanded for readability)
8) friendly "item in some_array" that translates to .indexOf() condition
9) @value becomes this.value
10) The existential operator? is awesome.
11) () -> a = 1 b = 2 return { a, b } # becomes: { a: a, b: b } There are others... I very much enjoy the syntax coffeescript has for its for loops.
for value in some_array
for value, key in some_array
for key of some_object
for key, value of some_object
for own key of some_object
for own key, value of some_object # for-of uses Object.hasOwnProperty() Coffeescript just needs a for loop form that works with iterators, then I will be happier. I can write in Coffeescript and distribute both that and the compiled JS, no problem. This feels comfortable to me. I hope was ES6 becomes common that Coffeescript's class syntax will "fall through" to the same ES6 way underneath. |
|