Hacker News new | ask | show | jobs
by gavinlynch 5175 days ago
I wonder where the blow-back is generated from. Personally, and only anecdotal of course, I feel that I have seen a far greater amount of articles extolling the virtues of CoffeeScript than I have seen condemning it. To be honest, that is the only primary source of whatever trace of resentment I feel towards CoffeeScript: I'm just almost bored of hearing about it. (tongue in cheek)

I don't use CoffeeScript, because Javascript suits me just fine. But I also don't know many developers that slam it or recall an abundance of anti-CoffeeScript articles... For whatever it's worth (shrugs)

3 comments

The top articles about coffeescript posted in r/javascript are anti-coffeescript articles.

There are many reasons not to use Coffeescript.

Some may claim that 'coffeescript is javascript', it really is not. They say it with a straight face too. People that say this don't really understand the difference between DOM and Javascript, and it is very telling. Just because you can access DOM methods and properties using compiled coffeescript does not mean that the coffeescript syntax IS javascript, and nothing could be further from the truth. DOM is DOM. Javascript is Javascript. Coffeescript is Coffeescript. Confusing them just makes someone look like they don't know what they are talking about.

Anyway, javascript has been the only language used to code front-end websites for quite some time (thankfully vbscript in IE is not used any more) and as a result it has become very well know, widely written about, and quite a lot of code has been written in it. There is a wealth of experience and all the 'gotchas' are well documented and there aren't really that many of them if you don't count anything to do with the DOM. Coffeescript introduces its own gotchas. While it may fix/avoid a few of javascript's gotchas, it introduces its own. And worse, there are new releases of coffeescript that break compatability, so much that the latest version of coffeescript now adds a comment at the top of any generated code with the revision of coffeescript used to create the "transpiled" code. If you think changing the rules of the language regularly is a good way to develop software, then we don't have anything further to talk about.

There are limitations to coffeescript that make it difficult to work with. You can't have the same variable name used twice in the same source file. The var command is ambiguous, and coffeescript's syntax is generally more ambiguous than javascript leading to programmer error. It is more difficult to read coffeescript because of ambiguity that you don't get with C style syntax. Javascript uses clear delimiters { } for where things begin and end, coffeescript does not and this means 'less typing' in coffeescript, but at the cost of readability. Some say coffeescript is easier to read, more power to them. Hopefully I'll never have to read their code.

"The top articles about coffeescript posted in r/javascript are anti-coffeescript articles."

Ah okay, r/javascript isn't in my regular rotation. So as I said, my only evidence is anecdotal.

Some may claim that 'coffeescript is javascript'... . People that say this don't really understand the difference between DOM [sic] and Javascript, and it is very telling.

I say this, and I believe I know the difference between the DOM and JavaScript, and have since before I've said that CoffeeScript "is" JavaScript. The DOM is a representation of HTML and XML document specified by the W3C, with an API for manipulation by scripts typically written in JavaScript. JavaScript is a trademark owned by the Oracle Corporation and licensed by the Mozilla Foundation, used to refer to a programming language standardized as ECMAScript, implemented by a whole bunch of vendors in a largely cross-compatible, ECMAScript Standard-compliant fashion, but often with many proprietary extensions. Would you very much mind explaining to me what I don't know about the difference between the DOM and JavaScript?

Do you agree that ECMAScript "is" JavaScript? Would you say ECMAScript Harmony "is" JavaScript? What if some future version of ECMAScript breaks backwards compatibility with ECMAScript 4, let's say, by vastly simplifying ==, but everything else stayed the same? Would you say this ECMAScript Imaginary wasn't JavaScript? It might be incompatible, but you'd still call it JavaScript, right? The point being, there is some backwards-compatibility-breaking change you would accept as not making a language "not JavaScript". So now our difference in opinion is to whether CoffeeScript's differences are enough to make it "not JavaScript".

I argue for my humble opinion that the semantics of CoffeeScript are so similar to that of ECMAScript 4 that just like ECMAScript Imaginary, you just have to take 5 minutes to read about what's different, and you'll be able to understand it just as easily.

There is a wealth of experience and all the 'gotchas' are well documented and there aren't really that many of them if you don't count anything to do with the DOM.

I agree with this. In fact, I have also been frustrated with people who don't know the difference between the DOM and JavaScript. I have never experienced this with CoffeeScript fanatics, however.

If you think changing the rules of the language regularly is a good way to develop software, then we don't have anything further to talk about.

If you think no one should ever attempt to improve an existing programming language, we also don't have anything further to talk about.

They are both straw men. Using an experimental tool is always associated with problems with the ground changing underneath you, that doesn't mean it is always not worth it. It's a tradeoff, and with "good practices", it can be worth it if you develop faster and rarely write forwards-incompatible code.

You can't have the same variable name used twice in the same source file.

The problem you are attempting to describe is the reason I currently use exclusively JavaScript in all my projects, however your description is inaccurate and misleading. You totally can have the same variable name twice in the same file. However, if one of them is in a inner scope than the other, the only way for the inner scope to shadow the outer scope to avoid munging a variable in an outer scope is for it to be a parameter to the function.

It is more difficult to read coffeescript because of ambiguity that you don't get with C style syntax.

I'm not sure what you mean by ambiguity, but I am quite certain that CoffeeScript has a provably unambiguous grammar.

From the article:

"I tend to be more critical of things before I’ve tried them, but I did try CoffeeScript to see what all the hype was about. It was nice, but it’s not worth it."

Apparently another blogger wrote that on his blog, and seems pretty even-handed with 'It's okay but not for me.'

The OP's response is "Stop whining and give it another chance." because clearly if someone tries CoffeeScript and says "Thanks, but no thanks." they're not smart enough to think on their own and should STFU and try CoffeeScript again.

> But I also don't know many developers that slam it or recall an abundance of anti-CoffeeScript articles...

There isn't one, but apparently the CS users need validation and have decided to take a page out of the GOP's handbook.