Non-generic traps for non-generic objects (was: Overriding Map/etc with get/set hooks?)

Tom Van Cutsem tomvc.be at gmail.com
Wed May 22 03:49:03 PDT 2013


2013/5/21 David Bruant <bruant.d at gmail.com>

> Would it make sense to add specific traps for specific objects (Date would
> have some specific traps, so would objects with [[MapData]], so would
> objects with [[SetData]], etc.)?
> Very much like functions currently have some traps that only apply to them.
>

Yes, it would work in the current Proxy design. However, the
function-specific "apply" and "construct" are arguably very generic and
very frequently used operations.

I would be reluctant to add ad hoc traps for intercepting access to very
specific operations on Date, Map, Set, WeakMap, etc. Moreover that design
doesn't scale beyond the ES6 built-ins. Arguably other host objects might
have other ops they want to intercept.

Cheers,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130522/130ee56a/attachment.html>


More information about the es-discuss mailing list