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
nope)

Considering the following code:

```javascript
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:

```javascript
var o = {i: 0};

(function(O){

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

}.bind(o,O));
```

  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
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to