[Harmony proxies] "if a trap is missing"

Xavier MONTILLET xavierm02.net at gmail.com
Wed Dec 7 10:23:26 PST 2011

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

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 <bruant.d at gmail.com> 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
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

More information about the es-discuss mailing list