Hacker News new | past | comments | ask | show | jobs | submit login

You can also call the original method without the ugly leading comma like this:

    _.throttle(
      ->
        console.log("Foo")
      500
    )



Is there any reason coffeescript can't be extended to support the same thing without parentheses? That feels fairly natural to me since it's similar to the object literal syntax.

Edit: Couldn't find that this has ever been suggested before, so I created a github issue: https://github.com/jashkenas/coffee-script/issues/2307


Nice, got me thinkin and tried this:

  _.throttle ->
      console.log("Foo")
    , 500
And it works!


That's what the author of this Gist was trying to avoid.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: