Classes as Sugar is now ready for discussion

David Herman dherman at
Thu Sep 9 16:31:32 PDT 2010

> Also, the duality of Object.create vs Traits.create accommodates traditional vs high integrity quite well -- without AFAICT compromising either.

It creates a false choice, though (all or nothing). IIUC, with Object.create, you don't even get the conflict checking. And then you've really lost the key benefit of traits.

I think there's room for alternatives in the traits space -- for example, something similar wrt trait composition, but that didn't bind |this| or freeze. That way, you could still integrate traits with the existing prototype system. For example, to compose traits to create an object that you then use as the prototype for a constructor. This would allow for the "vtables" approach and would also give you the ability to specify initialization behavior to invoke on instantiation, which you can't do with traits.js.


More information about the es-discuss mailing list