Lets try CoffeeScript

Lets try CoffeeScript



Ive been always interested in JavaScript - so its getting even more when is about compilers. Ive been keeping half an eye on the competitors lately: Dart, CoffeeScript, GWT and TypeScript.
Here you are a quick chart from Google Trends:
Dont look at the numbers, thats a very early result from 2008. Look at the current stand. CoffeeScript is highly on the top. To be really honest Im a theoretical Dart fan. Dart is kind, Dart smart, Dart is important. It know everything that is necessary for a JS abstraction layer - and was on the right path. No idea whats happening. It seems they are still working on it but I miss the buzz lately.

TypeScript is pretty much Microsoft flavored and the website is designed for IE, so I dont think we should spend more time with it at this stage.

GWT is still probably the top level carnivore on the field, but that is definitely not for a tired night to try out. Ive did some small GWT projects and its a joy to work with it.

So CoffeeScript. Im not gonna copy-paste the tutorial, you can check it out also. It has a basic structural abstraction, such as functions, classes, literal grouping. And it has a nice functional flavored extension embed in the language, which is always nice, like a free lollipop. And lets not forget about thats its pretty dense.

The workflow is also simple: you write your code in CoffeeScript syntax and compile it with an appropriate tool - such as the Node plugin. I just fired up PHPStorm and added the CoffeeScript support. Then I installed the Node plugin and compiled my sample file - works as expected.

What Id like to do is to convert the daily-time-cutter project to CoffeeScript so I can see its working on a real code as well. My biggest fear is how easy to make it work with jQuery, the whole library. CF can accept plain-old JavaScript code without any problem - I mean, khm, by eval. Which is unacceptable.

Well see. Hope I can show you some diffs tomorrow.

---

Peter

Ps.: Ive just my friends (James) blog where he created a game in Coffee - its amazing! You have to check that out.


go to link download