2013/9/13 David Bruant <[email protected]>
>
> 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.
>
Returning the same object twice is taken care of by the use of WeakMaps,
separately.
I'm thinking of an implementation as follows:
// in a wet->dry membrane proxy's handler:
getPrototypeOf: function(dryShadow) {
if (!Object.isExtensible(wetTarget)) {
// no need to use the shadow
return wet2dry(Object.getPrototypeOf(wetTarget)); // wet2dry consults a
WeakMap to avoid creating multiple wrappers
}
var dryProto = wet2dry(Object.getPrototypeOf(wetTarget));
Object.setPrototypeOf(dryShadow, dryProto);
return dryProto;
}
Cheers,
Tom
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss