As popular as JavaScript has become, it’s not without its faults. I mean, entire books have been written on this topic, so whenever I come across a little project that seeks to leverage the power of JavaScript with cleaner syntax, I take a look.
The cleverly-named CoffeeScript is one such project. Check it out.
CoffeeScript is it’s own little language that compiles directly to JavaScript. I dig the syntax, too. More whitespace, fewer semi-colons, and cleaner notation.
Of course, it hasn’t quite reached version 1.0 so nothing is guaranteed; however, I’d venture to say that this could be something that’s eventually used to help write cleaner JavaScript code (though I’m not sure how well it’d play with framework-based JavaScript).
Thoughts?
Justin says
I think I like it… maybe. On the one hand, I think the first example (the Coffeescript) is far more pleasing to look at and easier to scan. However, I think it would take some time to break free of the habit of looking for things such as brackets. Having not read much about Coffeescript I am assuming that it uses [TAB] nesting to create an objects architecture as in the “kids” example. I would feel much more at peace if there was some sore of identifier declaring that “sister” begins another object in the array. But it definitely has potential. That is just my two cents.
Tom says
I’m with you – I used to prefer C-style languages more than whitespace delimited languages but the more I’ve used the latter, the more I’ve become a fan of them.
I like that brackets and semicolons can create way too much visual noise if gone overboard.
On the flip side, whitespace-delimited languages can make it difficult to know where a new object/variable/value/whatever is starting. On top of that, it can get tricky to trace syntax errors (permitting there’s no strict compiler).