B.3.1 The __proto__ pseudo property

Andrea Giammarchi andrea.giammarchi at gmail.com
Sun Apr 21 12:24:21 PDT 2013


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
<allen at 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 at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130421/e8ee9a8e/attachment-0001.html>


More information about the es-discuss mailing list