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 ?
On Sat, Oct 29, 2011 at 4:09 PM, Axel Rauschmayer <[email protected]> wrote: > Sorry for sounding harsh, but I’m really just curious: The example below > seems awfully contrived (wouldn’t even single inheritance easily do?) and I > don’t see |super| anywhere in it. Have you ever found the need for |super| > in a generic function? > > Even when we get traits, I don’t see myself as ever needing super-calls in > trait methods. That’s because |super| is a construct for subclasses, while > traits, in a way, are abstract superclasses. > > Now try to imagine many other object would like to implement the > 3Dpoint#isPositive method using 3DPoint as interface but without > necessarily extending it .... blah, I know this example is crap so I will > think about a better one. > > function Entity() {} // no point by default > Entity.prototype.setPoint = function (x, y, z) { > 3DPoint.call(this, x, y, z); > this.hasPoint = true; > return this; > }; > Entity.prototype._isPositive = 3DPoint.prototype.isPositive; > Entity.prototype.isPositive = function () { > return this.hasPoint && this._isPositive(); > }; > Entity.prototype.hasPoint = false; > > (new Entity).setPoint(1, 2, 3).isPositive(); // boom ? or super is bound > to Point ? > > > -- > Dr. Axel Rauschmayer > [email protected] > > home: rauschma.de > twitter: twitter.com/rauschma > blog: 2ality.com > > > >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

