Allen Wirfs-Brock (2013-05-07T20:57:52.000Z)
github at esdiscuss.org (2013-07-12T02:27:21.257Z)
So here is the plan that I'll review at the next TC39 meeting: 1. Add `Object.setPrototypeOf(obj, proto)` A obj must be extensible in order to change its [[Prototype]]. There are no realm restrictions. It's just like all the other `Object.*` methods in operating on any object, independent of realm association. 2. `Object.prototype.__proto__` is moved back to Annex B. It is defined as an accessor property with attributes `{enumerable: true, configurable: true}`. The get and set functions are defined equivalently to `Object.setPrototypeOf` and `Object.getPrototypeOf`. No realm restrictions. No reflection restrictions. `Object.getOwnPropertyNames(Object.prototype)` includes `"__proto__"`. 3. `__proto__` as a property key in an object literal (but not a class definition) is syntax with special semantics of setting the literal object's [[Prototype]] when it is created. It is a clause 11 feature and is not tied to the presence of `Object.prototype.__proto__`. 4. Both `Object.setPrototypeOf` and `Object.prototype.__proto__` are defined in terms of the [[SetInheritance]]/[[GetInheritance]] MOP operations (the names can still change). There are corresponding Proxy traps. There are no exceptional restrictions placed on the handlers. Just the normal invariants. In particular, if the target is non-extensible then the [[SetInheritance]] Proxy handler can't change the observable [[GetInheritance]] result for the proxy object.