Implementing membranes using proxies, and [[GetInheritance]]

David Bruant bruant.d at gmail.com
Fri Sep 13 00:41:23 PDT 2013


Le 13/09/2013 09:19, Tom Van Cutsem a écrit :
> 2013/9/12 Mark S. Miller <erights at google.com <mailto:erights at google.com>>
>
>     Membranes need shadow targets, because of non-extensibility of
>     objects and non-configurability of properties. This special case
>     of no-invariants-anywhere is not JavaScript. Trying to do
>     membranes without shadow targets is a useless exercise.
>
>
> True, but by removing the invariant check on getPrototypeOf, a 
> membrane proxy can now avoid the cost of actually storing the wrapped 
> prototype on the shadow target until the real target becomes 
> observably non-extensible (which may never occur).
>
> More generally, membranes always need to be set-up with shadow 
> targets, but they don't actually need to use them until the real 
> target has some invariants.
If one wants Object.getPrototypeOf to return the same object twice, the 
membrane has to associate a new prototype with a given object. If there 
is a shadow target, the place of where to store this object is pretty 
obvious ([[Prototype]]).
That said, the good property that remains is that if a prototype setting 
capability has been kept around is that prototype chains can be built 
lazily.

Davod
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130913/d8bf06f5/attachment.html>


More information about the es-discuss mailing list