coffee-script icon indicating copy to clipboard operation
coffee-script copied to clipboard

`defer()` arity

Open s4y opened this issue 12 years ago • 1 comments

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

s4y avatar Nov 11 '12 03:11 s4y

Any suggestions on how to implement this? On Nov 10, 2012 10:44 PM, "Sidney San Martín" [email protected] 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.

maxtaco avatar Nov 11 '12 15:11 maxtaco