B.3.1 The __proto__ pseudo property

Andrea Giammarchi andrea.giammarchi at gmail.com
Sun Apr 21 13:23:46 PDT 2013


love it ... reminds me those days when [] or {} were invoking Array and
Object in some env ...

Anyway, I believe Allen is trying to say that {__proto__:whatever} should
be spec'd as syntax, regardless what will be of the
Object.prototype.__proto__ property/descriptor so that you can get rid of
it but then you can always trust that syntax.

In this case __proto__ looks ugly but makes sense ... also because it does
not need to loop/copy on JS side

So basically that would do exactly what an utopian/never-existent
Object.setOwnPrototype({literal}, whatever):{literal} would do





On Sun, Apr 21, 2013 at 1:19 PM, André Bargull <andre.bargull at udo.edu>wrote:

> 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?
>>
>
> SpiderMonkey/JSC currently just use [[Set]] without any further checks,
> i.e. when you re-define Object.prototype.__proto__, you're able to
> interfere object creation which uses __proto__. Is this intentional?
>
> js> Object.defineProperty(Object.**prototype, "__proto__", {set:
> function(){print("setter")}})
> ({})
> js> ({__proto__: null})
> setter
> ({})
>
>
> - André
>
> ______________________________**_________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130421/5982c007/attachment.html>


More information about the es-discuss mailing list