Allen that's correct/expected ... as __proto__ is "own" in the Object.prototype only or am I missing something?
On Sun, Apr 21, 2013 at 12:21 PM, Allen Wirfs-Brock <al...@wirfs-brock.com>wrote: > > 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 > > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss