Allen Wirfs-Brock (2013-12-03T19:56:43.000Z)
domenic at domenicdenicola.com (2013-12-10T01:33:25.072Z)
On Dec 3, 2013, at 11:28 AM, Andrea Giammarchi wrote: > I find mixin useful for what it has always done until now (that is temporarily gone and it is un-shimmable due this new toMethod entry for what I can tell so it will likely not be adopted later on) Object.mixin was always unshimmable because of the its super rebinding semantics. See http://people.mozilla.org/~jorendorff/es6-draft.html#sec-mixinproperties > Still very looking forward for a concrete example where `super()` that points to a different one after `toMethod()` is desired, thanks. The the last meeting we also decided to eliminate the comparator argument to the Map constructor because it only was useful for the case where you wanted to memoize -0. Here is a "mixin" object that can be used to selectively add that support to any Map instance to any Map subclass's prototype or to any object that exposes the Map interface: ```js let MapM0 = (memo=> ({ has (key) { if (Object.is(key, -0.0) return memo.has(this); return super(key); }, get (key) { if (Object.is(key, -0.0) return memo.get(this); return super(key); }, set (key, value) { if (Object.is(key, -0.0) return memo.set(this, value); return super(key, value); } }))(new WeakMap); ``` Just mixin (using toMethod, or your own implementation of Object.mixin) the properties of MapM0.