Skip to content

Comment on Defer: Taming asynchronous javascript with coffeescriptparent

Comments

CoffeeScript is just for fun -- it's a thought experiment that tries to see how far we can run with JavaScript semantics towards a more usable language.

Apart from the fact that both compile to JavaScript, CoffeeScript and Objective-J don't really sit together in the same boat. Objective-J is an actual runtime and interpreter: every single method you call is intercepted and handled by "objj_msgSend", so that things like method_missing are possible. See:

http://ejohn.org/blog/javascript-language-abstractions/#comm...

CoffeeScript limits itself to current common patterns of JavaScript in practice, and (in a perfect world) would compile 1-to-1 into the JavaScript you would have written. Unlike an implementation of Ruby or Python in JavaScript, where even simple things like numbers work quite differently, the semantics of CoffeeScript are just JavaScript semantics -- so there shouldn't be anywhere for the abstraction to leak.

As to sticking to a single common syntax -- that's a very good argument, and I'd have hesitations introducing CoffeeScript into a team project. But if you just want to play around with a fun way to write JS. I encourage you to give it a spin. For an example, take a peek at this implementation of the Buddhabrot fractal (the render will peg your CPU, so use Chrome):

http://jashkenas.s3.amazonaws.com/misc/buddhabrot/buddhabrot...

Here's the CoffeeScript that runs it:

http://gist.github.com/463880

And here's the compiled JS (not too different):

http://gist.github.com/463881

Thanks for the explanation. It's definitely a cool hack. Looks like a fun project.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.