Binding arrow functions.

Rick Waldron waldron.rick at gmail.com
Sun Aug 24 20:31:39 PDT 2014


On Sun, Aug 24, 2014 at 9:52 PM, Mark Everitt <mark.s.everitt at gmail.com>
wrote:

> 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!
>

SpiderMonkey is correct. Arrow functions aren't meant to be a drop in
replacement for all functions. I replied to that bug confirming that Canary
is incorrect with relevant spec notes.


Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140824/b00f759d/attachment-0001.html>


More information about the es-discuss mailing list