3 ms·
I used CoffeeScript full-time for a year, both client-side and server-side (node.js). I completely agree with everything here -- it's a great summary, and it de
by crazygringo 13y ago
I used CoffeeScript full-time for a year, both client-side and server-side (node.js). I completely agree with everything here -- it's a great summary, and it describes exactly while I never, ever want to use it again.
In CoffeeScript, ambiguous code is the rule, not the exception. On top of that, things like variable capture and everything-returns-a-value introduce new kinds of bugs. The author says "realistically, the issues I have raised with CoffeeScript don’t come up every day," but in my experience they pretty much did.
But the real kicker on top of it all is that none of the stuff is documented. When you're trying to guess if you should use parentheses or a comma or an indent or a newline or a backslash or what, there are no reference documents to help you. The CoffeeScript home page just has a bunch of tutorial examples which give you an overall idea, but there's nothing rigorous, and the devil is in the details when you start combining aspects of the syntax.
In the end, I'm much more productive programming in JavaScript because I know exactly how the language works, no surprises. JavaScript has its fair share of warts, but you take a day or two to learn them, and then you never need to worry about them again. CoffeeScript, on the other hand, is just endless surprises. And I still felt that way after a whole year of using it at work. It's basically unlearnable -- no matter how much experience you have, you constantly find yourself pasting different versions of a line into the "try" tab of http://coffeescript.org/ http://coffeescript.org/ until you get one which, through trial and error, turns into the JavaScript code you want.
- ilaksh 13y agoYou completely agree with everything he wrote, after a year full-time? Really? So you would use curly braces and commas to specify an object, and then be confused when CoffeeScript doesn't get it? After a year you didn't figure out that its a best practice to leave off the parenthesis in just the outermost function call, but to include them in the other calls on a line to make things clear? After a year, you didn't realize that with the CoffeeScript scoping rules, you couldn't just throw in a global at the last second without looking carefully to see if it was used somewhere else? After a year, you still hadn't learned about function binding with fat arrow? After a year, you still hadn't learned that the existential operator (?) means you don't have to use typeof nearly as much?
- crazygringo 13y agoHa! Not necessarily those specific examples, but the overall reaction to it. Here are a couple of other articles which explain the same things: Section "full of surprises": http://ruoyusun.com/2013/03/17/my-take-on-coffeescript.html http://ruoyusun.com/2013/03/17/my-take-on-coffeescript.html http://ceronman.com/2012/09/17/coffeescript-less-typing-bad-readability/ http://ceronman.com/2012/09/17/coffeescript-less-typing-bad-... And here's an old HN comment of my own which described a few representative difficulties: https://news.ycombinator.com/item?id=4518892 https://news.ycombinator.com/item?id=4518892 Also, there's no such thing as a global in CoffeeScript (unless you explicitly specify window.xyz), since everything is scoped to the file. And that's the point -- it's ridiculous to have to "look carefully" at all your code to see if functions further down share a variable name inside of them. In JavaScript, you don't need to worry about that because you know "var" scopes each variable to its function, regardless of whether a higher function or global variable uses the same name. In CoffeeScript, you suddenly do have to worry about that, which is fairly insidious and bug-prone behavior.
- ilaksh 13y agoHm.. well you may want to use more precise language in the future, because you said you "completely agree" and that it describes "exactly". So you are saying that none of those particular issues are problems you are having today with CoffeeScript or were problems for most of the year? In which case, what problems did you have? Edit: it looks like in another thread you are pointing out some random and unmaintainable code examples that are ambiguous and saying that its hard to know how they will be interpreted by the compiler. Its hard to know how those examples would be interpreted by anyone, or why you would write code like that and create that problem for yourself.
- antihero 13y agoI used it for about 6 months, and realised that it simply wasn't worth the hassle. Yes, it looks a bit prettier and the destructuring is nice, but it adds a level of ambiguity that just ain't nice. The lack of explicit scoping is horrible, and the lack of actual named functions is annoying. The only thing I use now is JSX (when doing ReactJS), or TypeScript when not using JSX, as that adds actual value.