Implementing membranes using proxies, and [[GetInheritance]]

Tom Van Cutsem at
Fri Sep 13 03:35:15 PDT 2013

2013/9/13 David Bruant <bruant.d at>
> 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,

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;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list