News for hackers. Stuff that matters.
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()