Membranes, unmediated access to objects through Object.getPrototypeOf

Andreas Rossberg rossberg at google.com
Thu Oct 11 04:56:30 PDT 2012


On 11 October 2012 13:41, Mark S. Miller <erights at google.com> wrote:
> On Thu, Oct 11, 2012 at 4:25 AM, Andreas Rossberg <rossberg at google.com>
> wrote:
>> On 11 October 2012 09:32, Brendan Eich <brendan at mozilla.org> wrote:
>> > Tom Van Cutsem wrote:
>> >>
>> >> - Proxy.revocable returns a tuple {proxy, revoke}. While more
>> >> cumbersome
>> >> to work with (especially in pre-ES6 code without destructuring), this
>> >> API
>> >> gets the authority to revoke a proxy exactly right: at proxy birth,
>> >> only the
>> >> creator of the proxy holds the right to revoke it. This is infinitely
>> >> better
>> >> than a global Proxy.revoke(proxy) method that would allow arbitrary
>> >> objects
>> >> to revoke any proxy.
>> >
>> > Ok, thanks for this recap. It makes sense, the ocap treatments are
>> > working
>> > ;-).
>>
>> Even then I don't think the additional creation API is needed. The
>> handler itself can be mutable, right? So why not have a function
>> Proxy.revoke that takes a _handler_ (not a proxy) and replaces all its
>> trap methods by poisoned traps? This is still perfectly ocap (because
>> only the creator has access to the handler), but requires no extra API
>> for creating revocable proxies -- just make sure your handler is
>> mutable.
>
> How does the target get dropped? Remember, this all started with David's
> observation that without some additional magic, we have an unsolvable GC
> problem. This is still true.

Ah, right. If revoke also froze the handler object, then it could
delete the target, because it will never be observable again. Would
that be too magic?

/Andreas


More information about the es-discuss mailing list