B.3.1 The __proto__ pseudo property

Allen Wirfs-Brock allen at wirfs-brock.com
Sun Apr 21 18:19:27 PDT 2013


On Apr 21, 2013, at 3:11 PM, Mark S. Miller wrote:

> On Sun, Apr 21, 2013 at 1:37 PM, Brendan Eich <brendan at mozilla.com> wrote:
> Allen Wirfs-Brock wrote:
> On Apr 21, 2013, at 12:31 PM, Brendan Eich wrote:
> >  You don't want that to affect object literals evaluated in the same realm after such a deletion. Why not?
> 
> Why should it?
> 
> ... because it did in ES5-conforming implementations that support __proto__ as a de-facto standard *and* allow delete Object.prototype.__proto__.
> 
> 
>    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.
> 
> What?
> 
> Mark insists on delete Object.prototype.__proto__ making the magic go away. (Summoning Mark.)
> 
> ;)
> 
> I agree with the spirit of what Allen is saying, but I'm not sure if I agree on the particulars. {__proto__: whatever, ....} is special syntax sets the [[Prototype]] property of the resulting object to the value of whatever. This syntax does not invoke [[Put]] anything and has no relationship (beyond evocative similarity) to the property Object.prototype.__proto__, whether it has been deleted or not. This special status does not apply to obj.__proto__ = whatever, nor to object.__proto__. Those two do a simple [[Set]] (or, in ES5 terms, [[Put]]) and [[Get]] respectively, and so do depend on the existence and nature of an inherited __proto__ property.

Mark, as far as I could tell you are agreeing with the particulars I specified for {__proto__: whatever, ...}.  Please check the spec. strawman I posted.

Where we disagree  is may be WRT whether it is reasonable for Dunder proto be a regular accessor property.  Note that other characteristics of it that have been proposed (delete behavior, "not reflected", get function that throws when directly invoked, etc.) seems to require the use of an exotic object for Object.prototype.  Once you go that far, we might as well define Dunder prototype behavior as part of the exotic [[Get]] and [[Set]] behavior of that object.

Allen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130421/0f83e047/attachment.html>


More information about the es-discuss mailing list