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 a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss