On Apr 3, 2011, at 11:12 AM, Allen Wirfs-Brock wrote:

> On Apr 2, 2011, at 5:11 PM, Brendan Eich wrote:
>>> Is multiple inheritance a use case that TC39 intends to address in a 
>>> generic manner?
>> 
>> No.
> 
> Inheritance-based instanceof testing for the purpose of dynamic 
> classification of objects  is most appropriate in statically typed 
> subclasing===subtyping languages.  Multiple inheritance (at least for 
> interfaces) is almost essential in such languages.  That isn't is the case 
> for dynamically typed subclassing!==subtyping languages.  There is lots of 
> experience with such languages that shows that dynamic classification via 
> class or superclass inclusion testing is a poor practice. 

Thanks for filling in after my terse "No."

The countervailing force here is the DOM being implemented in C++ (or C in the 
old days) in browsers. Such implementations use nominal subtyping and it leaked 
right through into JS.

This is not just an accident of history: implementors want fast is-a testing in 
the host programming language. Nevertheless, we are working on self-hosting the 
DOM, which should help dispel concerns about performance and scalability.

I don't see a lot of instanceof checks in modern JS, even DOM-based JS, so I 
believe the "nominal subtyping for performance" argument is overstated. 
However, there are currently C++-implemented internal-to-the-DOM-and-browser 
code paths that do such is-a tests (e.g., event dispatch and bubbling). These 
need to be self-hosted, and the whole system benchmarked.

We'll keep this list apprised of results.

/be

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to