Converting an existing object to a proxy

Sean Eagan seaneagan1 at
Fri May 27 13:11:44 PDT 2011

On Fri, May 27, 2011 at 1:05 PM, 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.

[[Trap]] would also need to take a boolean "throw" argument as to
whether it should throw if the object has the handler, but does not
have the trap.  This argument would be set to true for fundamental
traps, and false for derived traps.  It would not need to take an
argument corresponding to the trap "proxy" argument since that could
be appended within [[Trap]] itself.

Sean Eagan

More information about the es-discuss mailing list