3 ms·
the gains of coffeescript quite clear As someone who has been writing JavaScript for 15 years and has never felt like writing it is a struggle I would ask... a
by weego 12y ago
the gains of coffeescript quite clear
As someone who has been writing JavaScript for 15 years and has never felt like writing it is a struggle I would ask... are they?
I don't know what it solves. Writing a language designed to be written by hand in another language and then transpiled to the first language you have to know in the first place to be any good at it has always seemed like a horrible non-solution. You don't know what you've actually written at that point.
- LBarret 12y agoFor you, it has no advantage. You have integrated all js by now and you avoid the common mistakes instintively. For me, it is the gray area, I am a language geek so the semantics of js are quite clear but js bytes me sometimes. In coffeescript, The syntax is better and the semantics are better exposed , so it may be a net win. For a guy who is already familiar with coffeescript, the change will be likely negative. Familiarity with coffeescript is likely to generate bugs in javascript. You're moving from one language to another after all. The impact won't be huge as the two are quite close, but there is no reason to change in the first place.
- gabemart 12y agoCan you give a few examples of common JS mistakes that coffeescipt prevents?
- dscrd 12y agoI'm not deep in either CS or JS, but I suppose one could find some pitfalls from the differences between == and ===, and from checking the existence of a variable? Also, JS switch/case statements follow the good-old maldesign from C where each body has to end with break or it falls through. Variable hoisting? This: http://dorey.github.io/JavaScript-Equality-Table/ http://dorey.github.io/JavaScript-Equality-Table/
- mmatants 12y agoI feel a lot of folks are not mentioning a huge thing CoffeeScript is valuable for - its list comprehensions and proper for-each. JS has them too as part of ES5 spec, but CS still is an elegant solution. It creates a whole new way to speak code, like in Ruby, Python and others. Syntax, variable niceties are great too, of course, but do not define CS alone.
- deleted 12y ago[deleted]