I see Javascript 6 will add traditional class based inheritance, and one argument I hear is that classes are inherently much faster than prototypes because they can be optimized away by the compiler when doing (JIT) compilation to native code or to bytecode. That sort of makes sense to my mind, but I'm not nearly an advanced enough programmer to really understand this stuff.
If one was looking at the fastest possible implementation of prototypal inheritance in a fictional dynamic language, what would be the drawbacks with regards to performance vis-à-vis traditional classes?
What if you add the feature to the fictional language that you can specify that some objects are "final" and their prototype chain cannot be changed at runtime? (Coexisting with traditional prototypal inheritance)
Aucun commentaire:
Enregistrer un commentaire