Standardizing __proto__

Allen Wirfs-Brock allen at
Fri Mar 18 10:21:37 PDT 2011

On Mar 18, 2011, at 10:02 AM, John-David Dalton wrote:

>> For symmetry with
>> Object.create, you might want Boolean.create, Date.create and so
>> forth, but that's still initialization-time, and TBH I would be
>> surprised if there were actually many collisions between libraries
>> that augment those prototypes.
> In the Script Junkie article I cover a few examples of collisions with
> Function.prototype's and problems with Array.prototype.
> Date.create, Function.create and the like clutters the API. I would be
> for a more generic Object.setPrototypeOf() addition.

Object.setPrototypeOf is just as bad as LHS __proto__ because is isn't atomic with object creation. That is the key thing from an implementation/optimization/security perspective.  Once an object is created its [[Prototype]] needs to be immutable.

More information about the es-discuss mailing list