Uniform proxy API via caching call and construct traps
# David Herman (14 years ago)
I don't like this idea. It's inconsistent with the behavior of the other traps, it relies too subtly on a funky stateful idiom, and it's hard to predict when the traps will actually fire (since it depends on how clients use the proxy). If there's something being set once-and-for-all I prefer it to happen up front and explicitly.
When the uniform proxy API [1] was being explored, was it ever considered to just cache the "call" and "construct" traps within the proxy during the Proxy.create() call rather than look them up each time the proxy is called as a function or constructor? That seems to solve most if not all of the issues I've seen mentioned. There is a precedent for this in that a constructor's "prototype" property is cached in the internal [[Prototype]] property of objects it constructs during the call to [[Construct]].
[1] strawman:uniform_proxies
Thanks, Sean Eagan