Binding arrow functions.

Mark Everitt mark.s.everitt at
Sun Aug 24 19:26:04 PDT 2014

Sorry, should have sent this to the group...

That seems a little unsatisfactory. I'm aware of the difference in terminology of course. The problem remains that arrow functions make bind etc. unpredictable. You're relying on the programmer to do the right thing and that's a bad idea IMO.

Can you point me to one of the threads you mention? A quick search turned up nothing on thus earlier, and I should read one of those to get up to speed.

On Mon, Aug 25, 2014 at 3:12 AM, Domenic Denicola
<domenic at> wrote:

> From: es-discuss [mailto:es-discuss-bounces at] On Behalf Of Mark Everitt
>> There seems to be no clean way to tell apart regular functions and arrow functions (the only way I can do this is by looking at the result of toString). That being the case, arrow functions mean that we can no longer trust call, apply and bind, since we cannot easily tell if the function we want to bind is an arrow function and will silently ignore us.
> There have been multitudes of threads on this before, but the short recap is that arrow functions are functions, not methods. That is, they do not change their behavior depending on what `thisArg` they are called with. Other examples of non-method functions include:
> ```js
> function f(x) {
>   return x * 2;
> }
> var g = (function () { return; }).bind({ foo: 5 });
> function F(x) {
>   var hidden = x * 2;
>   this.f = function () {
>     return hidden;
>   };
> }
> var h = (new F(12)).f;
> ```
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list