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

Tom Van Cutsem at
Wed May 22 03:49:03 PDT 2013

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

> 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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list