maxtaco / coffee-script

IcedCoffeeScript
http://maxtaco.github.com/coffee-script
MIT License
726 stars 58 forks source link

`defer()` arity #44

Open s4y opened 11 years ago

s4y commented 11 years ago

Hey,

It turns out that Socket.IO looks at the arity of callbacks (LearnBoost/socket.io#268) and deferrals always have an arity of zero. (Some other JS libraries use functions’ arity too.)

It would be cool if deferrals had the right arity. I have a workaround which looks like this:

await …, ((cb) -> (arg) -> cb(arg))(defer(arg))
await …, defer(arg) # instead of this
maxtaco commented 11 years ago

Any suggestions on how to implement this? On Nov 10, 2012 10:44 PM, "Sidney San Martín" notifications@github.com wrote:

Hey,

It turns out that Socket.IO looks at the arity of callbacks ( LearnBoost/socket.io#268https://github.com/LearnBoost/socket.io/issues/268) and deferrals always have an arity of zero. (Some other JS libraries use functions’ arity too.)

It would be cool if deferrals had the right arity. I have a workaround which looks like this:

await …, ((cb) -> (arg) -> cb(arg))(defer(arg))await …, defer(arg) # instead of this

— Reply to this email directly or view it on GitHubhttps://github.com/maxtaco/coffee-script/issues/44.