Shorthand for "function" keyword
d3ck0r at gmail.com
Sun Nov 12 09:56:26 UTC 2017
On Sun, Nov 12, 2017 at 1:11 AM, T.J. Crowder <
tj.crowder at farsightsoftware.com> wrote:
> On Sun, Nov 12, 2017 at 6:09 AM, Naveen Chawla
> <naveen.chwl at gmail.com> wrote:
> > Who uses functions instead of arrow functions and methods these
> > days, anyway? (I know, people who haven't adopted ES2015+)
Arrow functions fail to convey 'this' There is this library I'm using that
calls the callback with .call( instance, ... ) and an arrow function does
not get the instance handle. I've tried to convince the library maintainer
to pass it as an argument rather than trying to encode it as this, so that
both old and new function styles can be used; but not with much success.
Arrow functions passed as callback to Node.js addons execute 20% slower
than regular 'function()' functions.
native code they are slower..
> Laurentiu's been fairly clear about his/her use case: Named inline
> callbacks. I don't think he/she cares whether the functions are arrow
> functions, so long as they have names. (Laurentiu, correct me if I'm wrong
> there.) Right now, if you want to pass a *named* inline callback to
> something, the simplest way is to use the `function` keyword.
> (I don't agree with the suggestion, but he/she's been clear about it.)
> -- T.J. Crowder
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss