For fans of Aquarius Records and music lovers everywhere, here’s a nicer interface I whipped up for listening and reading their bi-weekly new arrivals update. It is automated, so it will always be in sync with the latest update.
CoffeeScript is a little middleman language that compiles into JavaScript written by Jeremy Ashkenas, who is responsible for the Ruby Processing project.
It aims to bring elements of Python and Ruby’s cleaner syntax to JavaScript. CoffeeScript uses Pyhton’s significant whitespace instead of curly braces and does not require semi-colons for terminating lines. Right off the bat, the existence operator (?) struck me as quite slick. Checking if a variable is defined in JavaScript has always been a sore spot.
In JavaScript:
var solipsism;
if ((typeof mind !== "undefined" && mind !== null) && !(typeof world !== "undefined" && world !== null)) {
solipsism = true;
}
The same statement, in CoffeeScript:
solipsism: true if mind? and not world?
Note that a colon is used for assignment, as in JSON.
Other features include argument splats, Ruby ranges, more powerful switch statements, simplified lexical scoping, almost everything as an expression, and more.
It’s written in Ruby and uses racc for the parser.
More complex examples can be found here.