Re: Proxy forwarding handlers and accessor properties

2011-06-19 Thread Tom Van Cutsem
I agree with all of David's points. I wonder though: would it make more sense if we'd spec. the get trap of Proxy.Handler as: get: function(name, proxy) { let val = this.target[name]; return typeof val === function ? val.bind(this.target) : val; } Then both method accessor

Proxy forwarding handlers and accessor properties

2011-06-16 Thread David Flanagan
With ordinary objects, methods and property getter functions are both invoked on the object itself. If this object is proxied with Proxy.Handler, however, the property getter function will be invoked on the original object and the method will be invoked on the proxy object. The code below