Hacker News new | ask | show | jobs
by debacle 5177 days ago
> Consider the closure syntax in JavaScript:

Proceeds to list example that isn't valid JavaScript.

I have no fundamental objections with CoffeeScript, but I will never use it because there's nothing wrong with JavaScript that CoffeeScript improves upon.

For me, personally, it's way easier to visually scan a file that looks like this:

var helloWorld = function () {

     // ...
}

Than this:

helloWorld ->

    // ...
It's also easier to grep and sed.

I don't mind if you use CoffeeScript, but don't try and force-feed me some BS about concise syntax, make broad generalizations (complex CoffeeScript is harder to debug than JavaScript), or attack someone as a 'whiner' because they said "It's nice, but not my cup of tea."

My thought process:

1. In order to debug CoffeeScript, I will need to know JavaScript.

2. If I run into a tricky problem, not only will I need to know JavaScript but I'll also need to know the CoffeeScript compiler's internals.

3. If I run into a really tricky problem, or if I need some sort of optimization, I might have to use JavaScript anyway.

4. JavaScript is actually quite a nice language to program in.

5. All of the libraries I will be using will be written in JavaScript.

6. wu.js ain't nuthin' ta fuck wit. [1]

Therefore, I'll keep using JavaScript. YMMV.

[1] wu.js is actually quite a killer library: http://fitzgen.github.com/wu.js/

5 comments

The correct syntax is: helloWorld = ->

You just learn that -> == function() {}

That said, I found it hard to parse until I started working in it for a few weeks and got used to it. Now, reading function() and {} everywhere seems like a mess of boilerplate to me. Really, it is just a matter of what you are used to.

re #3: Also, I can't think of an optimization that JS has that can't be expressed in CS. It just doesn't work like that.

re #5: That seems like a kind of crazy generalization. How can you say that when CS 'compiles' to JS anyway?

I wasn't defining a function in that example, I was calling a function that contained a closure as an argument (in both JS and CS). This is perfectly valid JavaScript.

I've edited the post to be more clear on this.

Proceeds to list example that isn't valid JavaScript.

The example is in fact completely valid JavaScript, used in what I consider to be a very typical way: calling a function with an anonymous function as an argument.

I don't mind if you use CoffeeScript, but don't try and force-feed me some BS about concise syntax, make broad generalizations (complex CoffeeScript is harder to debug than JavaScript), or attack someone as a 'whiner' because they said "It's nice, but not my cup of tea."

I'm confused that anything in the article came across as "force-feeding". My impression was that he attacked someone as a 'whiner' because they said people at Posterous who use CoffeeScript are not "real" JavaScript engineers.

Opinion: Your mistake parsing his JavaScript example damages your credibility as a JavaScript programmer, and your rant suggests that you didn't read the article very thoroughly before coming here to tell everyone how wrong he is. I would downvote this comment if I could.

Personally, I've played with CoffeeScript and I am a fan of the syntax sugar, but I use exclusively JavaScript for all my projects because I disagree with the scoping rules.

The example given is valid js...

Nobody is "force-feeding" you anything, just close your browser tab. If you missed the top of the article, it's the author that was offended first for using CS, there's no need to continue calling names.

And please drop the straw man arguments:

> 1. In order to debug CoffeeScript, I will need to know JavaScript.

Of course, and that's the beauty of it. CoffeeScript is a tool to write javascript.

> 2. If I run into a tricky problem, not only will I need to know JavaScript but I'll also need to know the CoffeeScript compiler's internals.

You never have to know the CS compiler's internals. The output is always valid (if it wasn't that would be a serious bug, not a problem in your script).

> 3. If I run into a really tricky problem, or if I need some sort of optimization, I might have to use JavaScript anyway.

Optimization can be done in CoffeeScript itself 99% of the times, and it already outputs very efficient javascript.

> 5. All of the libraries I will be using will be written in JavaScript.

Yes, that's nice isn't it? They all interact perfectly fine with your CS code.

> It's also easier to grep and sed.

Nobody's* saying JavaScript is a poor storage, transmission, or machine-read format; just that it's not one humans should have to use.

* Some people do say this, of course.