On Oct 29, 2011, at 7:48 AM, Andrea Giammarchi wrote: > I sai the example was crap indeed and it doe not matter what it does but how > and there is a super call. > Will super be assigned runtime or fixed in method creation ? > >
This is explained in http://wiki.ecmascript.org/doku.php?id=harmony:object_initialiser_super The summary answer is "fixed in method creation" (which in reality occurs at runtime...) super.foo(); means something very similar to referenceToAnObjectThatIsDetermineWhenTheMethodIsDefined.foo.call(this); If you want to do mixins that rebind super you would have to do something like: function combineMixins(mixinParent, ...mixins) { var mixinHolder = mixinParent <| {}; //create object into which mixins are merged for (var mx in mixins) { for (var methodName in Object.getOwnPropertyNames(mx)) { //ignoring possibility of name conflicts for this example Object.defineMethod(mixinHolder,methodName,mx[methodName]); } } return mixinHolder; } and you might use it like: var objWithInheritedMixins = combineMixins(prototype,mixin1,mixin2,mixin3) <| { ownMethod1 () {}, ownMethod2() {} }; > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

