Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

FYI, function application wraps rightward to the end of the line, or the end of the block, so:

    foo -> bar 'foo', -> 'bar'
Means:

    foo(-> bar('foo', -> 'bar'))
But in any case, you wouldn't write it like that.


Telling the user to write something in two different ways, depending on the argument being passed, isn't simple.

The point is an ending delimiter would greatly benefit CoffeScript.

Although CofeeScript certainly has its perks, anonymous function creating isn't simple then Javascript.


    > Telling the user to write something in two different ways, 
    > depending on the argument being passed, isn't simple.
Huh? Sure it is.

Fun fact: Any algorithm you can write in JavaScript can also be written as a single function, full of nested whiles, if/elses, fors, labels and breaks ... does that mean you should write your entire program as a single function? Nope.

I'd like to think that CoffeeScript functions read better without an "ending delimiter":

    $('button').click ->
      alert "hello"

    # Or:

    app.get '/', (req, res) ->
      res.send 'Hello World'
In any case, if you're interested in using CoffeeScript, but the lack of an ending delimiter is putting you off -- I encourage you to add one in your fork.


Jeremy, I don't know much about CoffeeScript but I'm having a really hard time parsing your last example. Did you mean

  app.get '/', (req,res) ->
    res.send 'Hello World'

?


I did indeed. Serves me right for commenting on the run.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: