what kind of problem is this fat arrow feature trying to solve ?

Andrea Giammarchi andrea.giammarchi at gmail.com
Tue Oct 1 15:43:16 PDT 2013

Apologies for the off topic, I swear I thought I opened a new thread for
that so here again my post. Thanks

- - - - - - - - - -

I need to read everything Brendan suggested but if anyone would be so kind
to refresh my memories on this arrow function I'd appreciate that. I don't
need much more than yes/no as answer, thanks.

  1. `var o = {method: () => this};` will o.method() return o ? (I guess

Considering the following code:

var Proto = (function(){
  this.method = () => this;
  return this.constructor;
}.bind(function Proto() {}.prototype));
  2. will it work as expected per each `new Proto` object ? (I guess nope,
everything referred to Proto.prototype)

Considering the following code:

var o = {i: 0};


  O.fatMethod = (i) => i + this.i;
  O.justMethod = function (i) {
    return i + O.i;


  3. will the `fatMethod` be ideally/theoretically/technically faster to
execute once made hot through JIT capable engines (or made preventively hot
since immutable in such form) ?

My bonus, humble, honest, and final question would be:

  4. what kind of problem is this fat arrow feature trying to solve
exactly, if it cannot be used for classes, direct methods assignment, but
only for some runtime event assignment instead of using bind and still
being unable to remove that listener later on ?

Thanks a lot in advance for any refreshing and/or enlightening answer, it's
actually a while I am wondering this stuff.

Best Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131001/a2bb1867/attachment.html>

More information about the es-discuss mailing list