-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
_.bind nontrivial constructor fix (?) #2845
base: master
Are you sure you want to change the base?
_.bind nontrivial constructor fix (?) #2845
Conversation
It is not important to support. Within a constructor function, I feel like we should rely on native |
Here's the thing though. Lines 770 to 778 in 4334c12
And it works for simple constructors, but not for fancy stuff like
|
I don’t believe that it’s terribly important — these sorts of tickets are originally driven by test-case, nit-picked development, not real-world use cases ... But, if it doesn’t cost us much (in bound function call speed, and in file size) to support all constructors with this PR, I think it’s fine and good to merge it! |
Time for another benchmark, then. |
A quick summary of what led up to this diff:
_.bind
performing worse than nativeFunction.prototype.bind
, due to it basically beingslice.call(arguments)
+ native bind (at least at the time)._.bind
previously worked with nontrivial constructors such asDate
in environments that supported native bind, but not anymore. This has been the status quo since June 2015._.bind
.I'm not actually sure this should be merged. Is using a bound function as a constructor important to support? On the other hand, #2199 was probably the wrong solution to the wrong problem in the first place, so maybe this detour should never have been made.