_.bind nontrivial constructor fix (?)#2845
_.bind nontrivial constructor fix (?)#2845jgonggrijp wants to merge 3 commits intojashkenas:masterfrom
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:
_.bindperforming worse than nativeFunction.prototype.bind, due to it basically beingslice.call(arguments)+ native bind (at least at the time)._.bindpreviously worked with nontrivial constructors such asDatein 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.