Converting an existing object to a proxy

LungZeno lungzenoopen+es4 at
Sat May 28 18:07:51 PDT 2011

On Sat, May 28, 2011 at 2:05 AM, Sean Eagan <seaneagan1 at> wrote:
> On Fri, May 27, 2011 at 12:43 PM, Sean Eagan <seaneagan1 at> wrote:
>> Of course you could go the other way, and remove the default trap
>> implementations.  All objects could have the same internal method
>> implementation regardless of whether or not they are a proxy.  Within
>> each internal method there could be a check as to whether the object
>> is a proxy (has a [[Handler]]) AND has the trap, if so, it is invoked,
>> otherwise the default pseudocode is performed.
> The pseudocode for checking if the object has a [[Handler]], and if
> that [[Handler]] has a trap, and then invoking the trap could all be
> factored out into a [[Trap]] (or something) internal method, which
> takes a trap name, and a list of arguments to pass to the trap, and
> returns whether or not the object has the trap, and if so, also a
> return value from the trap.  This would make for a very concise and
> clear spec with regard to proxies, and it would be relatively easy to
> update the current proposal to do this.
Another way, every object has a [[Proxify]] internal method
corresponding to Object.createFrom. Host objects have their
[[Proxify]] different to native objects. [[Proxify]] can also be
trapped w.r.t. invoking Proxy.createFrom(aProxy, handler, proto).
> Thanks,
> Sean Eagan
> _______________________________________________
> es-discuss mailing list
> es-discuss at

More information about the es-discuss mailing list