2011/12/6 David Bruant <[email protected]>

> "All traps are optional. If missing (more precisely, if
> handler[trapName] returns undefined), the proxy defaults to forwarding
> the intercepted operation to its target object." [1]
>
> Proxy({}, {get:undefined}).someProperty;
>
> In this case, the description says that the operation is forwarded. I
> would prefer a TypeError to be thrown in this case.
>

To do this, the proxy would need to test whether the trap actually exists,
by performing an "in" test on the handler.
This breaks the double lifting pattern [1], which depends on the only
interaction between the proxy and the handler being property access.

Aside from that main issue, I think it would be odd for Proxy({},{}).foo to
just work while Proxy({},{get:undefined}).foo would fail with a TypeError.

Cheers,
Tom

[1] See <http://wiki.ecmascript.org/doku.php?id=harmony:reflect_api>, last
code snippet under "Forwarding".
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to