Luke Scott (2015-02-06T05:37:39.000Z)
d at domenic.me (2015-02-17T18:09:44.068Z)
With the code example I provided Foo is the class, not the mixin. Foo needs to be copied so traits can be added to it. Here’s an example: ```js class Foo {} class Fooy extends mixin(Foo, SomeTrait) {} ``` “Foo” needs to be copied and the methods from SomeTrait needs to be added to the copy’s prototype, which Fooy then extends. This is how you would traditionally copy a “class” (pre-es6 rev32): ```js class Foo { constructor() {} } function copy(classObject) { function ctor() { Foo.call(this); } ctor.prototype = Object.create(classObject.prototype); ctor.prototype.constructor = ctor; return ctor; } ``` Although, after some discussion in a 6to5 issue, this may (hopefully) be legal: ```js class Foo { constructor() {} } function copy(classObject) { return class extends classObject {}; } ``` As long as the prototype of the class can still be modified, that should work.