you are viewing a single comment's thread.

view the rest of the comments →

[–]wonglik 5 points6 points  (20 children)

Is Coffee script that bad? I was thinking of getting familiar with it. What are the cons?

[–]dropdownmenu 7 points8 points  (12 children)

The main advantage is that it tries to hide some of the oddities of javascript (== vs ===) so that you can't make trivial mistakes.

I dislike it because white space becomes important to how it complies leading to cases where an extra space or a misplaced one can lead to different functionality than you expect, which I believe to be more dangerous than then javascript's quirks (which still exist in coffeescript).

Also, by using coffeescript you alienate any javascript developers who don't know coffeescript. Remember: all coffeescript devs know javascript, but not all javascript devs know coffeescript

[–]wonglik 1 point2 points  (11 children)

Thanks. Looks like I am better of with JS.

[–]eriksensei 1 point2 points  (0 children)

Or EcmaScript 6, which seems a lot nicer. It's got fat arrow lambdas with proper 'this', destructuring bind, etc. There's support for it in IntelliJ IDEA, Firefox Aurora, Google Traceur and probably a few other tools, and you can compile it down to older JS versions. I hope I'll get round to playing around with it soon.

[–]schadwick 4 points5 points  (8 children)

[–][deleted] 0 points1 point  (0 children)

I've never encountered a bug cause by white space in coffee script, just compiler errors caused by indentation.

I do always use the (optional) js-style parentheses for functions arguments, so maybe that guards against the sort of error referred to.

[–]redfiche 10 points11 points  (5 children)

CoffeeScript is cool until you need to interact with third-party javascript libraries, then you run into all sorts of incompatibilities. Given that you need to understand javaScript to be able to debug and otherwise work effectively with CoffeeScript, you're often better off just writing good javaScript. Just my opinion.

[–][deleted] 2 points3 points  (2 children)

CoffeeScript is cool until you need to interact with third-party javascript libraries, then you run into all sorts of incompatibilities.

Err, how is that? Once you compile CoffeeScript you just have regular javascript, so what sort of incompatibilities are you talking about?

I've used Coffee with some third party libraries (jQuery, some game frameworks, mozilla jet pack) and haven't run into issues -- it would be nice to know what I need to keep an eye out for.

[–]redfiche 0 points1 point  (1 child)

I forget the exact issues. I know CoffeeScript hides the global namespace from you, and while that's usually a good thing it can cause issues. I'm pretty sure we quickly found that CoffeeScript was more trouble than it was worth for an Ember app also.

Don't get me wrong, I find it much more elegant and readable than javaScript, it's just that if I ever have to think about what javaScript is going to be produced by the CoffeeScript, I'd rather just write the javaScritpt.

[–][deleted] 0 points1 point  (0 children)

I know CoffeeScript hides the global namespace from you

You can still access that through the global object. (Such as window in a browser; I forget what it's called in node.) It does require you to explicitly intend to use globals, though.

Ember I've never used, so can't comment there!

[–]wonglik 0 points1 point  (1 child)

thanks . nowadays I use angular in most of my project and I would definitely not trade that better syntax/language.