On __proto__ as a magical data property

Andreas Rossberg rossberg at google.com
Thu Jul 19 02:56:14 PDT 2012


On 19 July 2012 00:19, Jason Orendorff <jason.orendorff at gmail.com> wrote:

> On Wed, Jul 18, 2012 at 3:31 PM, Brendan Eich <brendan at mozilla.org> wrote:
> > In particular, we don't want a proto-chain walk from [[CanPut]] and a
> second
> > walk from the "has" under the __proto__ setter for
> >
> >   obj.__proto__ = safe; // not in SES code
> >
> > just because we might need the "has" for
> >
> >   evil = Object.getOwnPropertyDescriptor(Object.prototype,
> '__proto__').set;
> >
> >   // later ...
> >
> >   evil.call(victim, unsafe);
> >
> > How would you spec this?
>
> I would spec the desired semantics.  I really don't think we should
> bend the language spec an iota around performance here.
>

I like Jason's suggestion, and I agree that performance should be the least
of all concerns for proto mutation.

(In fact, can we perhaps spec it in a way that guarantees that this
operation is so expensive that it discourages everybody from still using it
in the future? Like, insert a step that says "pause for 10 seconds to
reconsider". :) )

/Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120719/281d1711/attachment.html>


More information about the es-discuss mailing list