B.3.1 The __proto__ pseudo property

Brendan Eich brendan at mozilla.com
Sun Apr 21 12:31:10 PDT 2013

Allen Wirfs-Brock wrote:
> On Apr 21, 2013, at 12:05 PM, Brendan Eich wrote:
>>>> What I mean is that:
>>>>      let obj = {__proto__: null}
>>>> will always create an object whose [[Prototype]]
>> Didn't you mean "an object whose property named '__proto__'" here?
>>>> is null.  Regardless of whether or not anybody has done:
>>>>     delete Object.prototype.__proto__.
>>> Yes, that's what I just wrote!
>>> What part was unclear?
>> Sorry, I misread your "[[Prototype]] is null" as "property named '__proto__' is null".
>> But you cannot break ES5. Why are you changing things to deviate from it, never mind from ES6 consensus?
> We must be talking across each other...web reality is that
>     var obj = {__proto__: someObj};
> creates a new object whose [[Prototype]] is the value of someObj (assuming it is valid for that use).  Right?

Argh, you're right. I'm wrong, the de-facto standard wants [[Put]] not 
[[DefineOwnProperty]] and that's what ES5 specified.

I plead jetlag and throw myself on the mercy of the court!

>    Doesn't that mean that ES5 implementations that support that semantics already deviate from the ES5 spec which says that an own property named "__proto__" should be created via [[DefineOwnProperty]]?

That follows.

However, let's get back to (a) coffee :-); (b) ES6 and the ability to 
delete Object.prototype.__proto__.

You don't want that to affect object literals evaluated in the same 
realm after such a deletion. Why not?

SpiderMonkey at least goes out of its way to do [[Set]] (let's call it) 
not [[DefineOwnProperty]] for 'o = {__proto__: 42}', so why wouldn't 
[[Set]] create a fresh property, seeing nothing on Object.prototype 
named '__proto__' with a setter to run?


More information about the es-discuss mailing list