Live data from Hacker News

Intro to CoffeeScript

aseemk.com

11–20 of 95 posts

Re: Intro to CoffeeScript

#11
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.

You could possibly argue the semantics thing about Ember.

Re: Intro to CoffeeScript

#12

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?

After you load up the CoffeeScript module in your app.js (server.js etc) you can actually write an entire node.js app in CoffeeScript.

Re: Intro to CoffeeScript

#14

I stopped using CS because it's going to have some issues when ES6 becomes more of a real thing. For instance, how is CS going to handle for/of loops when ES6 has it's own for/of loops that is slightly different. The same goes for class and super. There will have to be CS2 that introduces new semantics and old apps will have to be migrated.

>There will have to be CS2 that introduces new semantics and old apps will have to be migrated.

I'm sure there will be a new version of CS when ES6 becomes widespread, but why would old apps need migrating? CS produces regular JS, and thus will be 100% compatible with ES6.

Re: Intro to CoffeeScript

#15
Why does everybody compare CoffeeScript against vanilla JavaScript? I find using underscore makes my code sufficiently elegant that I've never felt the need to switch to CoffeeScript.

Re: Intro to CoffeeScript

#17
post #16

Why does everybody compare CoffeeScript against vanilla JavaScript? I find using underscore makes my code sufficiently elegant that I've never felt the need to switch to CoffeeScript.

[deleted]

bentlegen is probably talking about http://underscorejs.org/

Re: Intro to CoffeeScript

#18
This is a fantastic slide deck. The per slide comments below are great too. Particularly on an iPhone as you read them simultaneously.

We've been using CoffeeScript for a bit over a year now and never looked back. All of our front end code is written in CS and I can't imagine writing JS again. It's just objectively better. Less code to write, easier to read, minimal cruft, and a joy to use.

The only hiccup was getting the compilation integrated into the build process. We handle it with direct loading of the CS files while working locally with coffescript.js loaded as well. That way code changes are available as soon as you refresh the page. Our build script for the app (when packaging it up for staging/prod) pre compiles the CS files so there's no compilation lag in prod.

I've been experimenting with node.js for a side project and its pretty easy to setup a project entirely in CS. There's a pretty good template with CoffeeScript/Express/Mongoose to use as a template here: https://github.com/olafurnielsen/form5-node-express-mongoose...

Re: Intro to CoffeeScript

#20
post #16

Why does everybody compare CoffeeScript against vanilla JavaScript? I find using underscore makes my code sufficiently elegant that I've never felt the need to switch to CoffeeScript.

[deleted]

He's talking about underscore.js which coincidentally was created by the same guy, Jeremy Ashkenas, that created CoffeeScript (and Backbone.js).

Underscore actually is still useful with CS. You just don't need it as often as a lot of the list ops are built into the language.

Post reply on HN