4 ms·
I see ES6 or especially Typescript as essentially a recreation of ES4/Flash AS3, with some renaissance-era Javascript footguns attached. You've got classes, var
by xiaoma 9y ago
I see ES6 or especially Typescript as essentially a recreation of ES4/Flash AS3, with some renaissance-era Javascript footguns attached. You've got classes, various class based OO features, optional typing major industry support, probably improved performance coming soon, etc...
Coffeescript was a bit different. It meant fewer lines of code, not more. It had significant whitespace and some other Python-inspired idioms like array comprehensions and object comprehensions. Most importantly, Coffeescript was a new language and didn't have to re-implement deleterious Javascript features like the == vs === distinction, undeclared vars leaking to global scope, baroque keywords like "with", etc...
That said as others have pointed out, ES6 did borrow many good features from CS and CS is slowly dying. Fortunately other languages like Elm and, to a lesser degree, Reason have offered even more compelling "footgun free" alternatives.
- masklinn 9y ago> It had significant whitespace and some other Python-inspired idioms like array comprehensions and object comprehensions. Modern JS has standard HoFs (on arrays) and an iteration protocol. > undeclared vars leaking to global scope Strict mode (which syntactic ES6 features enable by default e.g. class contents are in strict mode always). > baroque keywords like "with" Which can trivially be linted away. > ES6 did borrow many good features from CS Not really from CS, rather from similar (much older) sources CS got them from.
- xiaoma 9y agoHoFs are not array comprehensions and array comprehensions aren't supported in ES6. https://gist.github.com/sleepyfox/1879845 https://gist.github.com/sleepyfox/1879845 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Array_comprehensions https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- masklinn 9y ago> HoFs are not array comprehensions and array comprehensions aren't supported in ES6. Neither of these is a claim I made so I'm not sure why you feel the need to point these out. However native HoF obviate much of the need for comprehensions, especially combined with terser "arrow functions". Languages like Smalltalk or Ruby do just fine without comprehensions for instance.
- maxscam 9y agoIf you quote the fact that coffeescript has significant whitespace, list comprehension and then in response say that javascript has HoF and iteration protocol, it does sound like youre trying to counter the point, so it seems like for someone to bring up the fact that they are not identical is fair game.
- idiomatics 9y agoI love to read idioms at http://idioms.in/ http://idioms.in/ website.
- mavdi 9y agoYou're looking at the wrong bits. ES6 has delivered vast FP improvements and awesome async support.
- masklinn 9y agoThe only async support in ES6 were standardised promise objects and arrow functions (which cleanup the callback-heavy promise-based code). As well as extensive promisification of browser API but that's not directly ES6.
- xiaoma 9y agoIt's a bit presumptuous to tell me what bits to look at and then tell me about FP improvements when I just recommended Elm :D
- Eridrus 9y agoI inherited a coffeescript codebase a few years ago and found that it had footguns of its own due to a weak transpiler.