subclassof

Mark S. Miller erights at google.com
Mon Jan 18 12:41:54 PST 2010


On Mon, Jan 18, 2010 at 7:32 AM, P T Withington <ptw at pobox.com> wrote:

> In the various classes-as-sugar proposals, is there a way to test if one
> class is a subclass of another?  Is it as simple as:
>
>  classa.prototype instanceof classb
>
> ?
>
> In some of them, yes. For the desugaring presented at <
https://mail.mozilla.org/pipermail/es-discuss/2008-August/006941.html>,

    WobblyPoint.prototype instanceof Point

would work for the right reason. In some later proposals, no, because the
concept of subclassing is being replaced by the concept of trait
combination. Since this gives non-tree-like subtype relationships, it can't
accommodate instanceof.




> Should there be a `subclassof` operator?
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>



-- 
   Cheers,
   --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20100118/88e08f35/attachment.html>


More information about the es-discuss mailing list