On Sun, Nov 12, 2017 at 1:11 AM, T.J. Crowder < [email protected]> wrote:
> On Sun, Nov 12, 2017 at 6:09 AM, Naveen Chawla > <[email protected]> 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. Can't say that javascript itself is any slower; but when interfacing to 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 > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

