If we ever have the idea to introduce throw-when-trap-is-undefined handlers

David Bruant bruant.d at gmail.com
Fri Oct 19 07:46:56 PDT 2012


Hi,

This is just a short note.
In the previous design, some internal proxy operations threw when there was
a missing fundamental trap. We also considered at some point making missing
traps of Handler (previously VirtualHandler) [1] throw as well (I suggested
to make Object.getPrototypeOf(VirtualHandler.prototype) === Reflect, it's
still in the open issues).

I was playing with ES6 maps and I implemented a proxy wrapper for maps to
make them looks like objects (syntactic sugar) [2]. I wanted all irrelevant
traps to throw. It took about 5-6 lines to define a meta-handler as you'll
see, so maybe it's not worth defining "throw-if-undefined trap" when
another useful (and more complicated to implement) solution can be found.

David

[1] http://wiki.ecmascript.org/doku.php?id=harmony:virtual_object_api
[2] https://gist.github.com/3918227
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121019/c9146a75/attachment.html>


More information about the es-discuss mailing list