Binding arrow functions.

Mark Everitt mark.s.everitt at gmail.com
Sun Aug 24 18:52:45 PDT 2014


Today I encountered an inconsistency between SpiderMonkey and V8 (in Aurora
33.0a2 (2014-08-24) and Canary 39.0.2135.0 canary (64-bit)). In chrome, I
can bind an arrow function, and in firefox I cannot (see this gist:
https://gist.github.com/qubyte/43e0093274e793cc82ba)

I find reading the ES6 draft spec hard going, but from searching around I
get the impression that it states that bind should not be successful on an
arrow function. If this is the case, then it raises an issue. 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.

Having said all that, if I have the wrong end of the stick and this is a
bug in SpiderMonkey, please let me know!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140825/e03761f0/attachment.html>


More information about the es-discuss mailing list