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

One wouldn't know that intuitively, because what you wrote:

    longRunning
      () -> "Yippee!"
      () -> "Oh noes"
... is not valid CoffeeScript. I'm not sure where you got that from.

Ideally, you'd write it:

    longRunning onSuccess, onError
Or, if you really wanted to use two inline functions instead of local variables:

    longRunning (-> "Yippee!"), (-> "Oh noes")


Thanks. A more realistic example would, I suppose, look like this:

  longRunning (->
    ###
    bunch of stuff happening for success
    ###
  ), (->
    ###
    bunch of stuff happening for failures
    ###
  )


Yes, that'll work fine, as will this, if you prefer:

    longRunning ->
      # bunch of stuff happening for success
    , ->
      # bunch of stuff happening for failures




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: