CoffeeScript hits 1.0 -- Happy Holidays, HN
jashkenas.github.com
jashkenas.github.com
http://news.ycombinator.com/item?id=1014080
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.
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.
* 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...
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.
book.save
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
Compiles into this JavaScript: book.save({
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
}
});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.
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.
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.
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.
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!
-jsilv
There is some clear talent behind these projects.
Here's hoping for a larger community adoption!
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
Out of curiosity, what are you making?
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
Please direct any questions/feedback/correspondance to "pyrotechnick" on the social network of your choice.
# Fix things CS goofs.
# Add things CS lacks.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.
* 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.