Converting an existing object to a proxy

Sean Eagan seaneagan1 at gmail.com
Fri May 27 08:58:18 PDT 2011


On Fri, May 27, 2011 at 10:10 AM, Sean Eagan <seaneagan1 at gmail.com> wrote:
> I think the separation between proxies and regular objects is too
> much.  I would prefer to think of proxies as just a special kind of
> object.  All objects could be thought of as having a handler (
> [[Handler]] ), and "proxy objects" could be those objects whose
> handler is an actual ES object as opposed to an abstract language
> specification object.

We could instead say that all objects have a [[DefaultHandler]] which
contains the default trap implementations.  Then object's that have a
[[Handler]] are "proxy objects".  For trap resolution if an object has
a [[Handler]] and the [[Handler]] has the given trap, invoke it.  If
an object does not have a [[Handler]] or [[Handler]] does not have the
given trap, then, for derived traps invoke the object's
[[DefaultHandler]]'s trap, for fundamental traps perform the abstract
spec defined pseudocode for the given internal method.  Then proxy
fixing would mean that the object will no longer have a [[Handler]],
and "Proxy.createFrom" means that the object will now have a
[[Handler]].

We could also define default handler's for object types which override
certain internal methods such as Arrays and Functions.  These would
inherit the trap implementations from Object's default handler.

Thanks,
Sean Eagan


More information about the es-discuss mailing list