That if you are given a method with an already bound super, toMethod allows you to create a method like it with a different super binding -- without source manipulation. mixin does not -- again, without source manipulation.
I like Allen's point about [[HomeObject]] being like [[Scope]]. They are both lexically captured. Given < https://people.mozilla.org/~jorendorff/es6-draft.html#sec-function.prototype.tostring> and eval, the required source "manipulation" to rebind both is trivial, and does not require parsing or transformation of the source. This has the advantage that, to do *any* rebinding of lexically captured things, you have to supply rebindings for *all* of them. What toMethod does is allow rebinding [[HomeObject]] while preserving the captured [[Scope]]. Is this a bug or a feature? The old analogy that "toMethod is like bind" does not support this partial rebinding. "bind" binds the this-binding of non-bound, non-arrow functions, which have no lexically captured this-binding. Arrow functions do have a lexically captured this-binding, and bind does not affect it. If you want to write a mixin or mixin creator, use Allen's abstraction technique intentionally and from the beginning. I think this is good. On Mon, Feb 23, 2015 at 4:24 PM, Kevin Smith <[email protected]> wrote: > > > Doh! Nevermind. I get it. > > > > Can you explain what you realized, briefly? > -- Cheers, --MarkM
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

