Tom Van Cutsem (2013-09-11T14:17:14.000Z)
2013/9/11 David Bruant <bruant.d at gmail.com>

> Le 11/09/2013 06:10, Boris Zbarsky a écrit :
>
>  Hey all,
>>
>> I was looking at implementing a membrane using ES6 proxies and ran into a
>> snag.  Consider a situation where object A has prototype B.  A' is a proxy
>> implementing the membrane, whose target is A.
>>
>> But now if Object.getPrototypeOf(A') is invoked the return value will be
>> B (unless it just throws).  There's no way for A' to return a new proxy B'
>> whose target is B in this situation.
>>
> In essence yes. In practice, you can do:
>     // trap:
>     getPrototypeOf: function(target){
>         target.__proto__ = B';
>         return B';
>     }
> But of course, it changes A [[Prototype]], which is probably not
> desirable. And of course, although to-be-standard, __proto__ is bad taste...
>

Indeed, this is also the pattern I used, except it doesn't set the
`__proto__` of the real target, but of a shadow target: <
https://github.com/tvcutsem/harmony-reflect/blob/master/examples/membrane.js#L246
>.

Setting `__proto__` may be bad taste in general, but this is a case where
using this capability is necessary.

Ps: btw, wasn't "GetInheritance" supposed to be renamed "GetPrototype"?
>

I think we had agreement on that. Allen?

Cheers,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130911/a633472d/attachment-0001.html>
domenic at domenicdenicola.com (2013-09-25T01:40:12.545Z)
2013/9/11 David Bruant <bruant.d at gmail.com>

> In essence yes. In practice, you can do:
>
>     // trap:
>     getPrototypeOf: function(target){
>         target.__proto__ = B';
>         return B';
>     }
>
> But of course, it changes A [[Prototype]], which is probably not
> desirable. And of course, although to-be-standard, `__proto__` is bad taste...
>

Indeed, this is also the pattern I used, except it doesn't set the
`__proto__` of the real target, but of a shadow target: 
https://github.com/tvcutsem/harmony-reflect/blob/master/examples/membrane.js#L246.

Setting `__proto__` may be bad taste in general, but this is a case where
using this capability is necessary.

> Ps: btw, wasn't "GetInheritance" supposed to be renamed "GetPrototype"?

I think we had agreement on that. Allen?