bind operator (was: arrow function syntax simplified)

Kevin Smith khs4473 at gmail.com
Wed Mar 28 12:57:31 PDT 2012


Russell, I looked at the other thread more carefully and now understand
what you're saying.  Can't we use a bound |this| function for all these
cases?

    needsCallback(x => foo.bar(x));
    needsCallback(x => this.bar(x));

    // Suppose for a moment that -> also binds |this|
    needsCallback((x, y) -> {
  if (x) this.doX(x);
 else this.doY(y);
  });

It seems that with bound |this| functions, the need to explicitly bind
|this| tends to fall away.

kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120328/bef39559/attachment.html>


More information about the es-discuss mailing list