domenic at domenicdenicola.com (2013-09-25T01:44:50.120Z)
On Thu, Sep 12, 2013 at 4:14 AM, Tom Van Cutsem <tomvc.be at gmail.com> wrote: > But more generally, you're right that it's odd [[GetInheritance]] is doing > an invariant check on an otherwise extensible/configurable object. I think > it's simply a remnant of the time before we fully embraced setPrototypeOf. agreed > Mark, Allen, does that seem right? yes.
On Thu, Sep 12, 2013 at 4:14 AM, Tom Van Cutsem <tomvc.be at gmail.com> wrote: > [+markm, allenwb] > > 2013/9/11 David Bruant <bruant.d at gmail.com> > >> Le 11/09/2013 16:22, Tom Van Cutsem a écrit : >> >> [[GetInheritance]] always checks whether the proxy and target's >> prototype are the same, but as you pointed out, if the target is >> extensible, you can set its prototype to some other object before returning >> a value from the getPrototypeOf trap. >> >> It's annoying to cleanup post-trap though (to restore the target initial >> prototype). Is the invariant on getPrototypeOf that important on extensible >> objects? >> I think it is the only trap that enforces something without a related >> eternal invariant. >> > > For membranes, when using a shadow target, there's no need to > clean-up/restore anything. > > But more generally, you're right that it's odd [[GetInheritance]] is doing > an invariant check on an otherwise extensible/configurable object. I think > it's simply a remnant of the time before we fully embraced setPrototypeOf. > agreed > > Now that Object.setPrototypeOf is part of ES6, there doesn't seem to be a > point in guaranteeing the stability of Object.getPrototypeOf for extensible > objects. > > The important invariant is that getPrototypeOf remain stable for > non-extensible objects. > > Hence, it seems we could replace steps 8-10 of Proxy.[[GetInheritance]] < > https://people.mozilla.org/%7Ejorendorff/es6-draft.html#sec-9.3.1> with: > > 8. Let extensibleTarget be the result of IsExtensible(target). > 9. ReturnIfAbrupt(extensibleTarget). > 10. If extensibleTarget is true, then return handlerProto. > // steps below identical to the old steps 8-10: > 11. Let targetProto be the result of calling the [[GetInheritance]] > internal method of target. > 12. ReturnIfAbrupt(targetProto). > 13. If SameValue(handlerProto, targetProto) is false, then throw a > TypeError exception. > > Mark, Allen, does that seem right? > yes. > > Cheers, > Tom > > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > > -- Cheers, --MarkM -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130912/3a497b72/attachment.html>