Mark S. Miller (2015-02-24T00:38:53.000Z)
d at domenic.me (2015-03-06T00:44:34.875Z)
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.