You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even if an inheritance chain includes a mixin multiple times, mix() should only include it once. It should also follow C3MRO as documented in https://en.wikipedia.org/wiki/C3_linearization.
However, opposite to #61, in some of my tests, a mixin is getting included multiple times. For example, MixinA in the following example is included twice:
import{mix}from"mics/src/index";// Base classclassSimpleGreeting{foo(){console.log("SimpleGreeting foo()");this.textContent="Hello world!";}}// Root mixin A.constMixinA=mix(SimpleGreeting,Base=>classextendsBase{foo(){super.foo();console.log("Mixin A foo()");}});// Mixin B extends root mixin A.constMixinB=mix(SimpleGreeting,MixinA,Base=>classextendsBase{foo(){super.foo();console.log("Mixin B foo()");}});// Mixin C also extends root mixin A.constMixinC=mix(SimpleGreeting,MixinA,Base=>classextendsBase{foo(){super.foo();console.log("Mixin C foo()");}});// ExtendedGreeting extends SimpleGreeting, mixing in B and CconstExtendedGreeting=mix(SimpleGreeting,MixinB,MixinC,Base=>classextendsBase{foo(){super.foo();console.log("ExtendedGreeting foo()");}});// "new" doesn't work here, despite documentation saying that it doesconsteg=ExtendedGreeting();// Prints "Mixin A foo()" twice.eg.foo();
The text was updated successfully, but these errors were encountered:
Even if an inheritance chain includes a mixin multiple times,
mix()
should only include it once. It should also follow C3MRO as documented in https://en.wikipedia.org/wiki/C3_linearization.However, opposite to #61, in some of my tests, a mixin is getting included multiple times. For example, MixinA in the following example is included twice:
The text was updated successfully, but these errors were encountered: