B.3.1 The __proto__ pseudo property

Brendan Eich brendan at mozilla.com
Sun Apr 21 13:37:35 PDT 2013

Allen Wirfs-Brock wrote:
> On Apr 21, 2013, at 12:31 PM, Brendan Eich wrote:
> >  You don't want that to affect object literals evaluated in the same realm after such a deletion. Why not?
> Why should it?

... because it did in ES5-conforming implementations that support 
__proto__ as a de-facto standard *and* allow delete 

>    We already used the existence of {__proto__: whatever} got rid of<| as declarative syntax for defining an object literal with a [[Prototype]] other than object prototype.  Making {__proto__: whatever}  only work some of the times means it isn't a reliable declarative syntax.


Mark insists on delete Object.prototype.__proto__ making the magic go 
away. (Summoning Mark.)

Triangle died for several reasons, and I'm surprised to hear it here. 
Grinding an axe?

>    Why would we want to do that?  There is arguably a good motivation wanting disable the ability to dynamically __proto__ modify arbitrary pare-existing objects. But what is the motifacation for doing that on newly created objects?

I will tag Mark in here, but first make my own move:

Answer: because the clear way to implement this in ES5-conforming 
implementations that support __proto__ is to call [[Put]] not 
[[DefineOwnProperty]] if the name of the property being initialized in 
the object literal is '__proto__', and that's what engines implement.

That makes a new de-facto standard, which you should not be wasting 
energy trying to break!

>> 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?
> Because the semantics that says you can't use [[DefineOwnProperty]] may say to go out of the way to do something else.

Too late, ES5+reality happened. You are now proposing to break the web, 
at the limit. JS implementors will not go for that, so you are wasting 
your time.

>    It my strawman spec. it says use [[SetInhertiance]] rather than [[Put]].  Either is a special case semantics and [[SetInheritance]] is a much more direct expression of the likely user intent.

Direct, schmirect.

This is about compatibility and consistency, not what you can edit into 
a draft. Please reconsider. Must we put this on the next meeting's agenda?


More information about the es-discuss mailing list