Skip to content

bound functions do not perserve arities #3257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

layerssss
Copy link

I'm using coffee-script and connect.js. I came into a problem and digged into connect's source code, and I find on this line, connect uses Function.length to determine the type of a handler. And then I found coffee-script failed to perserve arities in bound functions of a class.

To indicate the issue, I added two test cases. The first one passed, but the second one failed. I'll try to submit a patch later.

Added two test cases, to ensure bound functions don’t lose their
arities.
@jashkenas
Copy link
Owner

If you know of a way to (compatibly) preserve arities in a bound function, feel free to send a patch. As far as I know, it can't be done.

@jashkenas jashkenas closed this Nov 25, 2013
@michaelficarra
Copy link
Collaborator

Duplicate of #2489, #2872.

@michaelficarra
Copy link
Collaborator

@jashkenas: It certainly can be done, as can be seen in #2489 and CoffeeScriptRedux's compilation.

@jashkenas
Copy link
Owner

Ah, right — when we have a reference to the source of the function, of course. I was mis-remembering from the "bind" operator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants