instanceof trap - Useful to implement promises through proxies

Sebastian Markbåge sebastian at calyptus.eu
Thu Nov 18 09:36:47 PST 2010


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 some IO or lazy
operation. This should be able to fail if the promise is currently
unresolved or "far".

It's the final piece missing to preserve "the invariants that keep the JS
lucid dream".

I'm also curious to hear any objections to this proposal. I don't see the
same issues as with mutable prototypes being applicable to proxies.

Sebastian Markbåge
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20101118/7ba5b90b/attachment.html>


More information about the es-discuss mailing list