Re: instanceof trap - Useful to implement promises through proxies

2010-11-22 Thread Tom Van Cutsem
Ok, I see. So it's true that the current Proxy API doesn't support promises that would throw on instanceof when unresolved and return a boolean when resolved. The main reason is that we didn't want proxies to meddle with the inheritance chain, in particular giving proxies the ability to implement

Re: instanceof trap - Useful to implement promises through proxies

2010-11-19 Thread Tom Van Cutsem
Hi Sebastian, Could you clarify why trapping instanceof is required for promises? It seems your use case can be addressed already using the current Proxy API: if `FP` is a function proxy, then `obj instanceof FP` will query `FP` for its `prototype` property (as per the default algorithm) by

Re: instanceof trap - Useful to implement promises through proxies

2010-11-19 Thread Sebastian Markbåge
Hi Tom, The idea here is that it's obj that's the proxy/promise. For example: var pet = future(); var closure = function(){ return pet instanceof Cat; }; resolve(pet); // later closure(); //? I should've clarified that it's the [Prototype] of pet that needs to be delayed. Not prototype of

instanceof trap - Useful to implement promises through proxies

2010-11-18 Thread Sebastian Markbåge
I thought I'd make the case for the instanceof trap in strawman:proxy_extensions - beyond multiple inheritance. I'm sure this point has been made before at some point. This is useful to implement various forms of promises using proxies. The prototype can be resolved at a later time perhaps after