David Bruant wrote:
Because max-min classes are inching towards consensus, I suggest the that appropriate way to subclass the built-in constructors will be via |class extends|. eg

class MyArray extends Array {
    someMyArrayProtoMethod () {...}
    constructor (tag) {
         super();
         this.tag=tag
    }
}
If that's the case, then that's perfect!
It suffers from the same issue than <| which is that it's syntax-based, so minimum cost is an ES6->ES5 compiler

But that is why subclassing the DOM via __proto__ has already dug in as a de-facto standard:

zepto.js:    return isObject(value) && value.__proto__ == Object.prototype
zepto.js: // to the array. Note that `__proto__` is not supported on Internet
zepto.js:    dom.__proto__ = arguments.callee.prototype

and why IE faces pressure to support __proto__, including setting for DOM objects.

New syntax may some day clean all this up but the short path wins and it'll be hard to displace. Let's be realistic. I agree we should, assuming classes make it, support DOM subclassing. That is good but it won't relieve DOM implementors from supporting __proto__.

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to