2011/11/29 Allen Wirfs-Brock <[email protected]>

> Because of the invariant validation mechanism, the target needs to be a
> direct reference to a native object rather than a mirror.
>

Indeed.


> If I understand the general usage model, then in the general case it may
> not be as lean as Proxy(target,handler) regardless of whether Mirrors are
> involved.  If the handler needs to retain any per proxy instance state then
> a new handler is going to have to be instantiated for each Proxy instance
> in order to capture that state. Proxy(target, new MyHandler(args))
>

Indeed, although it remains possible using the current API to write
stateless handlers that maintain their state in a WeakMap keyed by their
target (or the handlers themselves).

There will indeed be cases where handlers want to maintain other state
directly. Still, there will also be cases where the handler does not need
to retain extra state, and it's a good thing that in those cases, no
additional object allocation is necessary.

Cheers,
Tom
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to