Proxy-induced impurity of internal methods

Tom Van Cutsem tomvc.be at gmail.com
Mon Oct 10 11:31:40 PDT 2011


2011/10/10 Andreas Rossberg <rossberg at google.com>

> On 10 October 2011 16:01, Tom Van Cutsem <tomvc.be at gmail.com> wrote:
> > I will go over the proposed proxies spec to check whether there is
> actually
> > any harm in allowing a proxy to become non-trapping during an active
> trap.
> > If the proxy describes a coherent object before and after the state
> change,
> > there is no reason to disallow this. The new proposal Mark and I have
> been
> > working on may help here, since it enforces more invariants on proxies.
>
> I'm not sure I understand what you mean by "becoming non-trapping",
> can you elaborate? What would it do instead?


By becoming non-trapping, I simply meant "fixing the proxy" (i.e. the state
where the proxy no longer traps the handler, but instead "becomes" a normal
Object).

In the proposal we are writing up, we would split up the old fix trap in two
different traps:
- Object.{freeze,seal,preventExtensions}(p) would trigger p's "protect"
trap. That trap would effectively make the proxy
frozen/sealed/non-extensible. A frozen/sealed/non-extensible proxy can still
be trapping.
- A separate Proxy.stopTrapping(p) function would trigger p's "stopTrapping"
trap. If that trap does not reject the request, the proxy handler would be
"switched off", effectively turning the proxy into a regular object. This
corresponds to the "become" behavior of the current fix() trap.

Cheers,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111010/b1b950ff/attachment-0001.html>


More information about the es-discuss mailing list