Allen Wirfs-Brock (2013-04-21T19:21:04.000Z)
On Apr 21, 2013, at 11:53 AM, Brendan Eich wrote:

> Allen Wirfs-Brock wrote:
>> ...
> 
>>> This is specified by ES5, already.
>> 
>> Doesn't matter because what ES5 specifies is already incompatible with web reality when the property name is  __proto__.
> 
> No. Browsers implementing ES5 and de-facto __proto__ use [[DefineOwnProperty]] per ES5 to make '__proto__' in 'var o = {__proto__: "haha"}' an own data property shadowing Object.prototype.__proto__.
> 
> Anything else (some variation on de-facto __proto__ that uses a magic per-object hidden [[DefineOwnProperty]], e.g.) breaks ES5.
> 

from FF 22 scratchpad:


var p = {__proto__: "silly"};
Object.getOwnPropertyDescriptor(p,"__proto__");
/*
undefined
*/
Object.getPrototypeOf(p)===Object.prototype
/*
true
*/
var p = {__proto__: "silly"};
Object.getOwnPropertyDescriptor(p,"__proto__");
/*
undefined
*/
Object.getPrototypeOf(p)===Object.prototype
/*
true
*/
var p = {__proto__: "silly"};
Object.getOwnPropertyDescriptor(p,"__proto__");
/*
undefined
*/
Object.getPrototypeOf(p)===Object.prototype
/*
true
*/
var p = {__proto__: "silly"};
Object.getOwnPropertyDescriptor(p,"__proto__");
/*
undefined
*/
Object.getPrototypeOf(p)===Object.prototype
/*
true
*/
var p = {__proto__: "silly"};
Object.getOwnPropertyDescriptor(p,"__proto__");
/*
undefined
*/
Object.getPrototypeOf(p)===Object.prototype
/*
true
*/
var p = {__proto__: "silly"};
Object.getOwnPropertyDescriptor(p,"__proto__");
/*
undefined
*/
Object.getPrototypeOf(p)===Object.prototype
/*
true
*/
var p = {__proto__: "silly"};var p = {__proto__: "silly"};
var p = {__proto__: "silly"};
Object.getOwnPropertyDescriptor(p,"__proto__");
/*
undefined
*/
Object.getPrototypeOf(p)===Object.prototype
/*
true
*/
p.__proto__ === Object.prototype
/*
true
*/

var r = {__proto__: p};
Object.getOwnPropertyDescriptor(r,"__proto__");
/*
undefined
*/
Object.getPrototypeOf(r)===Object.prototype
/*
false
*/


I don't see any shadowing or __proto__ going on here.

Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130421/b08cbd18/attachment.html>
github at esdiscuss.org (2013-07-12T02:26:56.556Z)
On Apr 21, 2013, at 11:53 AM, Brendan Eich wrote:

> Allen Wirfs-Brock wrote:
>> ...
> 
>>> This is specified by ES5, already.
>> 
>> Doesn't matter because what ES5 specifies is already incompatible with web reality when the property name is `__proto__`.
> 
> No. Browsers implementing ES5 and de-facto `__proto__` use [[DefineOwnProperty]] per ES5 to make `__proto__` in `var o = {__proto__: "haha"}` an own data property shadowing `Object.prototype.__proto__`.
> 
> Anything else (some variation on de-facto `__proto__` that uses a magic per-object hidden [[DefineOwnProperty]], e.g.) breaks ES5.
> 

from FF 22 scratchpad:

```
var p = {__proto__: "silly"};
Object.getOwnPropertyDescriptor(p,"__proto__");
/*
undefined
*/
Object.getPrototypeOf(p)===Object.prototype
/*
true
*/
var p = {__proto__: "silly"};
Object.getOwnPropertyDescriptor(p,"__proto__");
/*
undefined
*/
Object.getPrototypeOf(p)===Object.prototype
/*
true
*/
var p = {__proto__: "silly"};
Object.getOwnPropertyDescriptor(p,"__proto__");
/*
undefined
*/
Object.getPrototypeOf(p)===Object.prototype
/*
true
*/
var p = {__proto__: "silly"};
Object.getOwnPropertyDescriptor(p,"__proto__");
/*
undefined
*/
Object.getPrototypeOf(p)===Object.prototype
/*
true
*/
var p = {__proto__: "silly"};
Object.getOwnPropertyDescriptor(p,"__proto__");
/*
undefined
*/
Object.getPrototypeOf(p)===Object.prototype
/*
true
*/
var p = {__proto__: "silly"};
Object.getOwnPropertyDescriptor(p,"__proto__");
/*
undefined
*/
Object.getPrototypeOf(p)===Object.prototype
/*
true
*/
var p = {__proto__: "silly"};var p = {__proto__: "silly"};
var p = {__proto__: "silly"};
Object.getOwnPropertyDescriptor(p,"__proto__");
/*
undefined
*/
Object.getPrototypeOf(p)===Object.prototype
/*
true
*/
p.__proto__ === Object.prototype
/*
true
*/

var r = {__proto__: p};
Object.getOwnPropertyDescriptor(r,"__proto__");
/*
undefined
*/
Object.getPrototypeOf(r)===Object.prototype
/*
false
*/
```

I don't see any shadowing or `__proto__` going on here.