Live data from Hacker News

Intro to CoffeeScript

aseemk.com

61–70 of 95 posts

Re: Intro to CoffeeScript

#61

Earlier quoted context omitted.

The overhead of having an additional dependency. The more moving parts there are, the more things can break.

Then why don't you write assembly?

1. Since when can you write web applications in assembly?

2. Languages built upon assembly generally have better user experience, better tooling, better semantics and effectively no more dependencies than assembly. CoffeeScript has very slightly better user experience, worse tooling, identical semantics and more dependencies than javascript.

Re: Intro to CoffeeScript

#62
post #25

> What I find sad, though, is that most people who dislike CoffeeScript don’t truly know it. They haven’t taken the time to really learn it, or even try it. Their reactions are usually knee-jerk, or based on fallacies. [...] The explanation for most people’s dislike of CoffeeScript is probably our natural resistance to new things and our comfort in what we know. Oh, wow. I've been using CoffeeScript for about a year…

I don't understand the "ecosystem" complaint. Every JS lib is interoperable with CS, so the only things needed in the CS "ecosystem" is syntax specific tooling. We'be got source maps and syntax highlighting for most editors, and most other JS tooling should work fine.

Re: Intro to CoffeeScript

#63

Yes, let me learn this domain specific language for a domain specific language so that I can learn another domain specific language whenever this one stops trending.

If you know Javascript, learning Coffeescript is easy. I became proficient in Coffeescript in a few hours, and I sure don't feel like a genius, so other people can probably do the same. It's just a more convenient way of writing Javascript, with a nicer syntax and some really pleasant features.

Re: Intro to CoffeeScript

#64
post #25

> What I find sad, though, is that most people who dislike CoffeeScript don’t truly know it. They haven’t taken the time to really learn it, or even try it. Their reactions are usually knee-jerk, or based on fallacies. [...] The explanation for most people’s dislike of CoffeeScript is probably our natural resistance to new things and our comfort in what we know. Oh, wow. I've been using CoffeeScript for about a year…

In my experience of using CoffeeScript, the author is absolutely correct. CoffeeScript is rejected for reasons "usually knee-jerk, or based on fallacies." I introduced it respectfully and fairly in a former team, and at first people are generally fainting and acting like the world will end.

(This is backend node.js work which emphasized tests and code review. I don't know what it's like outside that.)

Not all rejection is knee-jerk. "Usually" is the operative word here. I would have loved knowledgeable, reasoned critique. I personally assembled as many reasoned critiques as I could, to demonstrate my respect for reasoned, fair decisionmaking. I am continuously disappointed by the low standards of discourse, in programming culture.

(The first random misbegotten idea which pops into my lizard brain to confirm my prejudices, is not a sufficient "reason".)

Eventually, most realize CoffeeScript's sheer maintainability can far outweigh CoffeeScript's (real) flaws; some former detractors become downright zealots. Sure, some still dislike it; but they tend to be ignored because it's really not that bad. Nothing compared to the real problems that a team encounters.

Re: Intro to CoffeeScript

#65

Is CoffeeScript used much outside of Rails? If not, wouldn't it be a better idea to focus on mastering javascript so it applies globally?

CoffeeScript is, essentially, an unofficial Javascript 2.0. It's not at all tied to Rails.

Re: Intro to CoffeeScript

#66

Earlier quoted context omitted.

Then why don't you write assembly?

1. Since when can you write web applications in assembly? 2. Languages built upon assembly generally have better user experience, better tooling, better semantics and effectively no more dependencies than assembly. CoffeeScript has very slightly better user experience, worse tooling, identical semantics and more dependencies than javascript.

1. That's missing the point, but since you asked, Emscripten and Native Client.

2. I disagree that CS's user experience is only "very slightly" better, but that's very subjective.

Tooling is a somewhat valid complaint but it's a young platform and it's improving (source maps, etc).

Semantics aren't quite identical (scoping, implicit return values, "fat arrow" functions).

How does CS have more dependencies than any other compiled language? The only dependency is a compiler.

Re: Intro to CoffeeScript

#67

Earlier quoted context omitted.

1. Since when can you write web applications in assembly? 2. Languages built upon assembly generally have better user experience, better tooling, better semantics and effectively no more dependencies than assembly. CoffeeScript has very slightly better user experience, worse tooling, identical semantics and more dependencies than javascript.

1. That's missing the point, but since you asked, Emscripten and Native Client. 2. I disagree that CS's user experience is only "very slightly" better, but that's very subjective. Tooling is a somewhat valid complaint but it's a young platform and it's improving (source maps, etc). Semantics aren't quite identical (scoping, implicit return values, "fat arrow" functions). How does CS have more dependencies than any ot…

> 1. That's missing the point, but since you asked, Emscripten

Has LLVM grown an assembly frontend? Emscripten is more or less an LLVM backend.

> and Native Client.

These are no more web applications than writing firefox extensions at this point.

> Semantics aren't quite identical (scoping, implicit return values, fat arrow functions).

For the most part, this is minimal syntactic sugar, not significantly different semantics.

> How does CS have more dependencies than any other compiled language?

It does not, the point is that javascript has no dependency, and that if you're going to add a compiler dependency you might as well go for real changes.

Re: Intro to CoffeeScript

#68

Is CoffeeScript used much outside of Rails? If not, wouldn't it be a better idea to focus on mastering javascript so it applies globally?

I would recommend against using any CoffeeScript before you're proficient with JavaScript. It can be a great boon to productivity, but if you don't understand what it's doing underneath you'll shoot yourself in the foot a lot.

Re: Intro to CoffeeScript

#69
post #3

Is CoffeeScript used much outside of Rails? If not, wouldn't it be a better idea to focus on mastering javascript so it applies globally?

The presentation is very well put together, but CoffeeScript is a hack built on top of JS in order to use Ruby semantics. You're correct in that it's not really used outside of Rails, and not knowing JS proper (not that I personally recommend using it for much more than jQuery and a couple other libraries, when you absolutely must) poses a problem for when someone runs into the 97% of code that is JS.

I write CS for nodeJS apps every day. The only Ruby I write is for Chef and it usually makes me mad. I've never written a Rails app.

Re: Intro to CoffeeScript

#70
post #45

Earlier quoted context omitted.

I love CS myself. To me, in terms of aesthetics, CS is to JS what Scala is to Java. I have been bitten by the whitespace issue that you mention though. I don't recall the circumstance but an indent that was off just a bit did not cause the compiler to complain, but did cause it to generate code that I did not intend. It took some debugging of the JS output to find that one, and it certainly gives one pause to think h…

Compilers/interpreters complain about code that's invalid. Since the code is valid it shouldn't interfer, the problem is in the language's syntax design that's prone to shooting yourself in the foot. The design lets you mix indentations, something that Python won't let you do. A very simple scenario where hell is a keystroke away: hello = woot: 1 yay: 2 funfunfun: (x) -> x + 1 hello2 = woot: 1 yay: 2 nowthatsfun: (x)…

While the examples are completely accurate, I've just never run into an issue like that in practice. The majority of my codebase is CoffeeScript and it's just never been a problem.

It's pretty visually obvious when your indentation is out of whack. Even if it isn't, this kind of error would be picked up pretty quickly by your test suite.

Post reply on HN