Years have passed, and we have started, tentatively, to have some confidence in this language. Its approach to development that has become ever more “native” and it has broken away from the old logics of desktop development.

In 2009 the publication of CoffeeScript by Jeremy Ashkenas saw the unofficial birth and subsequent growth of a new approach to Javascript, one which was less negative and pessimistic in the approach it took to the language. This change in direction was well explained in the opening words of the project itself. So, what is CoffeeScript?

CoffeeScript is a little language that compiles into JavaScript. Underneath that awkward Java-esque patina, JavaScript has always had a gorgeous heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way. The golden rule of CoffeeScript is: "It's just JavaScript". The code compiles one-to-one into the equivalent JS, and there is no interpretation at runtime.

In other words? Javascript isn't the best language ever invented, don't make fun of us... but if we take a look at ECMAScript 5, or even the latest edition of the Javascript standard already implemented in all modern browsers, we've got to admit that it isn't that bad either. Applying some surgical modifications to the language to fix a few of the macroscopic errors resulting from the excessive haste in which the project was put together we'll be able to get something that's both good and usable, all the while keeping “close” to the native technology of the web!

How is it possible to apply these surgical modifications? As in the case of GWT and similar technologies, by making developers write in another language... but this time a language that is extremely similar to Javascript, capable of generating Javascript code that a programmer will find perfectly intelligible, and is as idiomatic as possible.

Which type of “errors” does CoffeeScript try to fix? Principally those relating to syntax. Javascript offers us very few of the comforts that most other, more evolved, languages do:

string interpolation;

multi-line strings;

default arguments;

splat operators;

list comprehension;

unstructured assignment;

OOP classes.

It's also extremely verbose... all a matter of repeating brackets, dots and commas, this, function and return !

class Greeter constructor: (@person, options = {}) -> greet: (person) -> fullName = "#{firstName} #{lastName}" if person.name is "Stefano Verna" """ Hello #{fullName}, This is a multiline string, wow! """ else "#{fullName}?! The hell are you?" person = firstName: "Stefano" lastName: "Verna" new Greeter(person).greet()

CoffeeScript offers an elegant solution to each one of these problems, introducing — where necessary — some pretty heavy modifications to the language:

white-space significance (brackets are out, Python-style indentation is in);

implicit return (everything is an expression);

_arrow-functions_: a new, more succinct syntax for defining functions ( -> );

); _fat-arrows_: a variation on the arrow-function designed to force an automatic binding on current scope at the moment of definition of the function itself ( => ).

The result? Faster, more enjoyable development and clearer code that gives a better understanding of the programmer's intentions; in addition to producing ECMAScript 3 compatible code (IE6 proof).