I noted some open issues on "Classes with Trait Composition"

Brendan Eich brendan at mozilla.com
Thu May 19 08:32:27 PDT 2011


On May 19, 2011, at 6:36 AM, Mark S. Miller wrote:

> 1) Starting from scratch, there's no problem engineering a VM to make objects-as-closures efficient, especially given the semi-static analysis that class proposal was designed to enable. However, JS VM implementors are not starting from scratch. Fitting such a new optimization into existing heavily optimized engines was thought to be a hard sell. Especially since all major VM implementors would need to agree.

The hardship comes in part from mutability and fresh identity per constructor call of all the closure-methods. Specifying these as immutable and joined, optimizing their references to constructor parameters and per-instance variables to avoid capturing each constructor call's environment, would help.


> 2) The conventional JS pattern is to place methods on the prototype, not the instance, and many felt that the main thing classes need to provide is a syntax to make this traditional semantics easier to express.

This is the big one.

/be



More information about the es-discuss mailing list