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

Jason Orendorff jason.orendorff at gmail.com
Fri May 24 16:14:18 PDT 2013


On Fri, May 24, 2013 at 4:52 PM, Tab Atkins Jr. <jackalmage at gmail.com>wrote:

> The problem is that the Map#set method grabs an *internal property*,
> bypassing Proxies, etc., so you can't defend against it.  If I could
> intercept access to [[MapData]] via proxy traps (like David suggests
> in the OP), everything would be *perfect* - every single problem I
> have would be resolved successfully, as would every additional
> possibility that Jason brings up.
>

I don't see how trapping access to [[MapData]] satisfactorily solves your
original problem. What spec text would you write?  Would you define the DOM
object in question to be a proxy?

If Maps used a Map.MapDataSymbol, I could intercept it via proxies by
> adding it to the symbol whitelist and do what I needed.  Of course,
> the object represented by [[MapData]] is too abstract to *actually* do
> that, but we could expose some interactions for it.
>

But that would look like... Map.

So we would have turned Map into a wrapper around a [[MapData]] object
that's what Maps are now (a concrete, non-hookable map).

It seems rather heavyweight. You can already get about the same effect just
by writing that wrapper yourself.

-j
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130524/3f0585ba/attachment.html>


More information about the es-discuss mailing list