3 ms·
I prefer coffee-script. It also works in the browser. http://jashkenas.github.com/coffee-script/ http://jashkenas.github.com/coffee-script/
by hasenj 16y ago
I prefer coffee-script. It also works in the browser.
http://jashkenas.github.com/coffee-script/ http://jashkenas.github.com/coffee-script/
- raganwald 16y agoThe good news for fogus is that everyone who prefers CoffeeScript validates the idea that an alternative syntax is enough of a win to be worth the adoption headaches.
- hasenj 16y agoIt's not just syntax, but some semantics too. Last expression in a function is returned. This includes assignment statements which are in fact expressions. foo = () -> a = bar() z = () -> if a b = fu() else b = kar() Here, foo returns the function z, and z returns either fu() or kar() while assigning the value to b One could argue this is just syntax but I think this way beyond the kind of thing that comes to mind when somebody thinks of "syntactic sugar".
- Homunculiheaded 16y agoDespite all of the weirdness of JavaScript, the lack of implicit return is it's biggest design flaw imho. The functional/scheme-like virtues of JS are well touted, but this small missing feature means implementing them always requires the slight but constant overhead of ending every expression with 'return', which then means that programming in a way which should be natural to javascript, isn't.
- jashkenas 16y agoFYI, you don't have to include an empty parameter list for defining functions that don't take any arguments. Just the arrow will do. foo = -> a = bar() z = -> if a b = fu() else b = kar()
- irahul 16y agoBut whatever he is after have to be much more lucrative than writing coffeescript. Apart from pleasant syntax, coffeescript also improves upon semantics where it can - this binding, lexical scoping etc etc. People are willing to adopt Coffeescript because it compiles to javascript, it has improved semantics and clean & mostly familiar syntax. To sum it up, the inertia is small when moving from JS to cofffeescript. That doesn't look like the case with funode.
- illamint 16y agoSeriously, CoffeeScript is amazing. I've been working on a large client-side project in CoffeeScript for the past few weeks and every time I look at the resulting JS output I can't imagine having written it by hand; it's been a massive boon to my productivity. I wrote JavaScript for years before this and hated it at times, and now I can't ever imagine going back if given the choice.
- messel 16y agoCoffeeScript is much easier to read than javascript, that alone is a blessing. Admittedly I haven't used coffeescript much yet, I just cranked it up with nodemon a couple of weekends ago. I need a good starter coffeescript project that works on the backend with node, and the client side.
- jarin 16y agoIt kind of says a lot about the language when you need to invent another language to make it safer and more enjoyable to use.