Imagine you have a proxy set dynamically, meaning that you don't have
the traps written in the code, you just pass variables. Then you need
the undefined value to behave the way it does or you can't default to
forwarding.
But I think there is a need to "disable" a trap. Meaning that instead
of forwarding, it would throw an error. So I'd say:
var p =Proxy({prop:1}, {get:undefined,set:null});
p.prop;// 1
p.prop = 2;// error: no set trap
On Tue, Dec 6, 2011 at 11:13 PM, David Bruant <[email protected]> wrote:
> Hi,
>
> "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.
>
> Opinions?
>
> David
>
> [1] http://wiki.ecmascript.org/doku.php?id=harmony:direct_proxies
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss