2011/10/18 David Bruant <bruan...@gmail.com> > > Ok for typeof. But there are other places where [[Call]] is used and the > proxy is expected to (indirectly) expose it. For instance bind: > ----- > var fpb = Function.prototype.bind; > var bind = fpb.bind(fpb); > var p = Proxy.for(function(){}, {}); // purposefully no 'call' trap > var p2 = bind(p, {}); // ? > ----- > Here, bind will look for an internal [[Call]] from p. What is it? It cannot > be the call trap since this one doesn't exist. Fallback to target.[[call]]? >
No, the way I see it, for a direct proxy wrapping a target whose typeof is "function", that proxy's internal [[Call]] tries to invoke the call trap, so its spec would be something like: [[Call]] ( Receiver, Args ) 1. Let H be the [[Handler]] property of the proxy 2. Let callTrap be the result of calling the [[Get]] internal method on H passing "call" as an argument 3. If callTrap is undefined or IsCallable(callTrap) is false, throw a TypeError 4. Return the result of calling the [[Call]] internal method of callTrap, passing Receiver and Args as arguments 'bind' will wrap the above [[Call]] method, which I think works out fine. Cheers, Tom
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss