prototype for operator proposal for review
lukeh at microsoft.com
Tue May 17 23:46:16 PDT 2011
> The primary scenario is what some people call "subclassing" the various built-in classes of objects that have special internal state and behavior. The most important of these "classes" are Array, Function, and RegExp. Programmer want to be able to create instances of these whose direct [[Prototype]] is different from the default. (in most cases the desired prototype will inherit from the default)
> An implementation might try to optimize such functions as you describe, but because both the global binding to the base object and the property binding of the method are mutable you at least have to have a dynamic guard on any fast path and still have to generate the code to create the arguments and do a regular call if the guard fails. I made the same argument for Object.create and I'm not aware of implementation that have yet to optimize it in this manner.
Fair enough. I'll check on whether we have considered any similar optimizations in IE.
More information about the es-discuss