News for hackers. Stuff that matters.
Re:Fogus: Node.js should become its own language by hasenj on Tuesday April 12, 2011 @09:52AM (#2437160)
I prefer coffee-script. It also works in the browser.

http://jashkenas.github.com/coffee-script/

Re:Fogus: Node.js should become its own language by illamint on Tuesday April 12, 2011 @10:43AM (#2437396)
Seriously, 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.
Re:Fogus: Node.js should become its own language by messel on Tuesday April 12, 2011 @11:52AM (#2437723)
CoffeeScript 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.
Re:Fogus: Node.js should become its own language by raganwald on Tuesday April 12, 2011 @10:07AM (#2437224)
The 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.
Re:Fogus: Node.js should become its own language by hasenj on Tuesday April 12, 2011 @10:29AM (#2437326)
It'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".

Re:Fogus: Node.js should become its own language by Homunculiheaded on Tuesday April 12, 2011 @11:33AM (#2437618)
Despite 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.
Re:Fogus: Node.js should become its own language by jashkenas on Tuesday April 12, 2011 @02:16PM (#2438423)
FYI, 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()
Re:Fogus: Node.js should become its own language by irahul on Tuesday April 12, 2011 @11:05AM (#2437488)
But 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.

Re:Fogus: Node.js should become its own language by jarin on Tuesday April 12, 2011 @11:36AM (#2437629)
It kind of says a lot about the language when you need to invent another language to make it safer and more enjoyable to use.