> It might make sense to provide this as standard functionality:
> - Testing if one type is a subtype of another type.
> - Returning all supertypes of a given type.
> 
> This is especially useful if a type can significantly change the behavior of 
> its subtypes and if there should ever be several ways of handling inheritance 
> in ES.
> 
> What are you suggesting exactly? Javascript doesn't have structural typing, 
> sadly. But in the type system we do have instanceof and getPrototypeOf can 
> already be used to this effect.


For example:

function inheritsFrom(constr1, constr2) {
    constr2.prototype.isPrototypeOf(constr2.prototype);
}

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

Reply via email to