2011/8/8 Brendan Eich <[email protected]> > Good point. So we are not going in a circle -- we're spiraling toward a > conclusion which is not that proxy should be provided to all traps, or none. > The get and set derived traps are special: they call through to accessors. > > (Proxy gurus, please check me if I'm misstating this. We need to build up > non-guru understanding of the full design's rationale.)
Indeed, get and set are special because they call through to accessors. But in that mindset, we can think of getPropertyDescriptor and getPropertyNames as special derived traps because they walk the prototype chain (requiring access to the proxy, or more precisely: the proxy's prototype). Why would we pass |proxy| to get/set but not to getPD/getPNs? So, counting getPD and getPNs as derived, that leaves us with four derived traps that require access to the proxy. If we leave it at these four, we can make a note in the documentation explaining why they need |proxy|. Or, we could generalize and provide |proxy| as an argument to all traps. My feeling is that developers will find this natural, since the Proxy API does allow the creation of multiple proxies that share the exact same handler object. The additional |proxy| argument allows such a shared handler object to naturally tell apart the proxies for which it is used. Cheers, Tom
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

