Hacker News new | past | comments | ask | show | jobs | submit login
CoffeeScript hits 1.0 -- Happy Holidays, HN (jashkenas.github.com)
289 points by jashkenas on Dec 24, 2010 | hide | past | favorite | 53 comments

Things have come a long way in the past year, since this conversation:


Some of the interesting recent features include executable class bodies, extended regular expressions, functions with default arguments, and YAML-style object literals.

Thanks for all the great suggestions and patches (almost a thousand Github issues, with many thousands of comments). The language has been very much a community driven project, and hopefully it reflects some significant part of the hard-earned wisdom of JavaScripters.

This rules! And thanks to everyone in #coffeescript for answering my stupid questions as they come up :)

Way to go!

The war on curlies is over, curlies lost.

Good to see new languages improving upon syntax, readability is key and a great way to gain adoption. As Norvig said, it is easier for him to explain an algorithm in python than any other language. Well, now CoffeeScript has just passed that test too.

Brendan Eich is also adapting many good things from CoffeeScript to JS.next, validating the point that coffee, in its short life, has been able to influence other great language designers.

And that says a lot about CoffeeScript and its potential.

I agree. If nothing else, CoffeeScript will be a success if some of its ideas find their way into a future version of JavaScript. It's been very gratifying to see folks like Crockford and Eich giving it a serious look:

* http://intertwingly.net/blog/2010/11/25/Hobgoblin-of-Little-...

* http://brendaneich.com/2010/11/paren-free/

* http://developer.yahoo.com/yui/theater/video.php?v=crockonjs...

I just wanted to point out that the first link you posted had a great discussion in the comments.

Much like this discussion ^w^

The page says, "Objects may be created using indentation instead of explicit braces, similar to YAML. "

Similar to YAML? What exactly does that mean? Is there someplace that explains the specific indentation rules?

The indentation rules of YAML are massively borked; it's not enough that something be indented, it has to be indented a very specific number of spaces. As opposed to, say, Haskell's more sane off-side rules.

CoffeeScript isn't particular about the specific number of spaces, as long as you're consistent. For example:

      title: "The Book of the Thousand Nights and One Night"
      length: 45
        "The Fisherman and the Jinni":       1
        "The Tale Of The Ensorceled Prince": 13
        "The First Kalandar's Tale":         27

Compiles into this JavaScript:

      title: "The Book of the Thousand Nights and One Night",
      length: 45,
      chapters: {
        "The Fisherman and the Jinni": 1,
        "The Tale Of The Ensorceled Prince": 13,
        "The First Kalandar's Tale": 27

I'm afraid that's not correct. You can use arbitrary number of spaces to indent a block in YAML[1]. It does't matter if it's 2 of 4 or 17.

The only limitations are that it must be greater than the indentation of the parent node (obviously), that all siblings must have the same indentation and that tabs are not allowed.

Are you sure you're not mistaking this with HAML? It's a bit stricter with the indentation requirements.

[1]: http://www.yaml.org/spec/1.2/spec.html#id2777534

"I'm afraid that's not correct. You can use arbitrary number of spaces to indent a block in YAML[1]."

Well, shit.

Thanks; how did I miss that?

"Are you sure you're not mistaking this with HAML? It's a bit stricter with the indentation requirements."

Oh, that I know. One reason I avoid it.

Congratulations Jeremy et al.

CoffeeScript has been and will continue to be a tremendously powerful catalyst for change in the JavaScript community.

CoffeeScript has successfully: advanced our organisations attitude towards JavaScript on both the server and client; rendered working with complex systems -- such as node.js and WebGL -- a breeze and allowed us to focus solely on the real problems at hand rather than quirks in a language.

Everyone who has contributed in any way whatsoever, or even only just toyed with CoffeeScript should feel privileged to be part of the fantastic community surrounding the language.

Thankyou for the great gift that is CoffeeScript 1.0 this Christmas.

Has anyone written a reverse CoffeeScript compiler that compiles legacy js into cs? Seems like it would be a great tool for starting off refactoring of big js files, or if you simply wanted to adopt cs as your standard.


It is not without its cavets, though, with a little work it could be brilliant.

Alot of things that are in CoffeeScript simply are not possible in JavaScript; given there is no 1-1 relationship between CoffeeScript and JavaScript constructs.

thanks! it means a lot to me. :)

i made this a couple of months ago as an experiment on someone's suggestion and ended up getting REALLY far. only current caveats are that some hacks are used (of course).. and CoffeeScript 1.0 is not supported. I have been busy and I don't know what kind of updates that will take right now. I have been meaning to get around to it of course, but for the mean time I put the demo up there. The source is of course open, it's written in JavaScript. Have a look in App.js. It's a recursive AST walker. If you do manage to patch it you can send me a pull request on github. The code is relatively clean and easy to read. It should also serve well as a learning tool to see what the symbols of CoffeeScript are.

Danke for the mention!


Like with HAML,one would think the htlm2haml tool was key to its adoption

It's pretty clear that jashkenas is the Chuck Norris of Javascript.

For the last week I've been using CoffeeScript along with Backbone.js & Underscore.js (all backed by jashkenas) and it's given me a much greater appreciation for the power of javascript.

There is some clear talent behind these projects.

It's amazing how much more I like Javascript under the guise of CoffeeScript. JS got a lot right, and when you get rid of (most) of the wrong, it really shines.

Here's hoping for a larger community adoption!

And some clear talent behind the great documentation, too!

The best new language of the year 2010. Thanks jashkenas!

Newbie question: How is CoffeeScript typically used? On a web server running node.js? In the browser after including CoffeeScript the way you might include jQuery? Either? Some other way?

Anywhere you might use JavaScript. For building web sites, working with canvas, doing servers with Node.js, or scripting the JVM with Rhino ... for example:

A Riak client: http://riakjs.org/

A canvas sketch: http://jashkenas.s3.amazonaws.com/misc/buddhabrot/buddhabrot...

A string scanning library: http://sstephenson.github.com/strscan-js/

An in-browser tank game: https://github.com/stephank/orona

A Node.js-powered Rack server: http://josh.github.com/nack/


Since CoffeeScript itself is written in CoffeeScript it was quite easy for the team to create a distribution of the compiler that runs in the browser.

You can find it in the extras folder of the source code repository.

Usually though, people opt to pre-compile their CoffeeScript on the server, pack, optimise and minify it before serving it to clients.

At Feisty, we write CoffeeScript that is intended to be executed on both the server and client.

To achieve this, we wrote "requisition" - https://github.com/feisty/requisition - a server-side packager and client-side loader - via require() - for CommonJS Modules written in CoffeeScript.

For a simpler, ad-hoc solution check out my tutorial project "Walk the Line" - http://github.com/pyrotechnick/walk_the_line

Great work Jeremy! I've been using CoffeeScript extensively for an upcoming project, and having written 1000+ lines of it so far, I'm loving it!

Now if someone made a Cappuccino like framework on top of CoffeeScript instead of Objective-J I'd be in heaven :)

Out of curiosity, what are you making?

We are developing an open-source MMO on node.js and WebGL - http://github.com/feisty

Is there something I can do to get involved with this project?


I am "pyrotechnick" on Skype/Twitter/Facebook/Google Talk

We would love to hear from anyone who can contribute anything to the projects. Or who is interested in an alpha/beta

I want to build one too. Any chance the repo's receive meaningful README's ?

I'll endeavor to equip the projects without meaningful READMEs proper introductions over the next week. For the moment you can learn a little more about the projects at http://github.com/feisty/cortex/wiki

Please direct any questions/feedback/correspondance to "pyrotechnick" on the social network of your choice.

The web UI side of a readinglist manager, complete with offline syncing.

Congrats to the team! I've been using CoffeeScript together with underscore.js, backbone.js and of course jQuery. Together they make functional style programming and building MVC pattern so much easier. Thanks for building such an expressive language.

Thanks for this Jeremy and everyone who contributed. I've held off really coming to grips with javascript because I found it ugly and full of too many gotchas. But Coffeescript has got rid of all those excuses!

Satoshi Murakami deserves a large portion of the credit for the changes leading up to 1.0 -- his Coco dialect of CoffeeScript has been a strong influence on the features and optimizations that happened this fall.


I thought I have a pretty good handle on CoffeeScript, but Coco's README confused me. Can someone explain the reasoning behind Coco's features? Can't seem to discern their purpose.

  # Fix things CS goofs.
  # Add things CS lacks.

Aha - thanks. And thanks satyr!

Been holding this one back for awhile, but: Are there any talks, plans or otherwise on incorporating other languages for client-side scripting? I'd really just like to get away from JS in general :(

There are yes. I'll try to dig them up shortly.

IMHO it will never happen in the sense you imagine it but we'll see.

In the meantime you may want to check out emscripten (http://code.google.com/p/emscripten/). It is a JavaScript backend for LLVM which ultimately leads to the same functionality as having other languages on the client.

Congrats on the release! Here's hoping for a CoffeeScriptConf in 2011

Who was responsible for that rad new CoffeScript logo / when was it added to the site? Coffee-cup and typography look awesome! (Also, love the language).

Ramesh (https://github.com/rampall) just contributed it this week. Great timing.

Thanks stenson! Great timing indeed. I stumbled upon coffeescript barely a week before the 1.0 release and fell in love.

This looks awesome. I've never used it, nor much JS, but now I'm going to write something in it or about it. Cheers

Would people be interested in a Ruby-oriented project like this? Say, tiny.rb ported to use Javascript? (Some Googler already has a Lua-esque VM for tiny.rb as her 20% project.)

There are a number of existing projects that compile a partial Ruby into JS:

* https://github.com/superchris/rubyjs

* https://github.com/jessesielaff/red

* https://github.com/tlrobinson/cappruby

I'm afraid that Ruby semantics don't align too well with JavaScript semantics. Things as basic as numbers, method dispatch, and variable scoping don't work the same way. Either you end up with perfectly valid code written in one that doesn't run on the other, or you have an extremely slow Ruby interpreter implemented on top of JavaScript.

This is the main reason why CoffeeScript tries to stick as close to JavaScript as possible.

Perfectly valid code that runs in one and not the other is fine, so long as context switching can be minimized between browser and server. (It's still a switch, but smaller.)

Thanks Jeremy! I think CoffeeScript is a wonderful replacement for JavaScript, it made client side code so much nicer to write for me. Been using it since 0.7 (?).

Thank you for CoffeeScript (changed my life!), and a very Merry Christmas to you!

Good job guys. I've just started using this in my side projects. Excited!

Congrats, Jeremy. Hope you have some well earned rest over the holidays.

should be possible tecnically having a coffescript for php?

Applications are open for YC Winter 2022

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact