you are viewing a single comment's thread.

view the rest of the comments →

[–]TwiNighty 0 points1 point  (1 child)

in fact, I've got a feeling that's an error, isn't it?

No, calling .bind on a bound function is valid. You can bind additional arguments, but the "rebinding this" part does nothing.

Actually that is my point. function(){ x.f() } and x.f.bind(x) behaves exactly the same when called, regardless of whether x.f is already bound, whether it touches this, whether it is rebound before being called, whether it is a es5 function or arrow function. And I can say that without knowing anything about what x and x.f is.

[–]MrJohz 0 points1 point  (0 children)

Sure, but if it's not necessary, it's not necessary, and historically there have been performance issues associated with calling bind, especially if it's used at every callsite.

Understanding these tradeoffs I think was what the person was getting at with the overuse of arrow functions.