On Apr 21, 2013, at 12:31 PM, Brendan Eich wrote:

> 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!

Suspended sentence...and I really should be finishing preparing for my own 
European speaking trip rather than being sucked into this dismal mess...

> 
>>   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?

Why should it?  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.  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?  

> 
> 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.  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. 

Allen


_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to