In a vein similar to making [] available to collections, one could make "new" 
and "instanceof" available to other inheritance schemes.

For example:

// “Meta-class” for prototypes as classes/instantiable prototypes
function ProtoExemplars() {}
ProtoExamplar.prototype.{
    operatorNew(...args) {
        let inst = Object.create(this);
        return inst.constructor(...args);
    },
    operatorInstanceof(lhs) {
        return this.isPrototypeOf(lhs);
    }
};

-- 
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

Reply via email to