You really don't *want* proxies to equal their underlying objects:  proxies
can show properties that the underlying object doesn't have, hide
properties that the underlying object does have, alter the appearance of
other proxies, etc.

What you probably want is to never deal with the underlying object in the
first place, unless you absolutely have to.  That's why you'd create a
proxy anyway...

Have you heard about membranes?  I've talked about them on this list
recently, as have several others over the years...

I don't intend to toot my own horn too much, but you might want to check
out my es7-membrane project:
https://github.com/ajvincent/es7-membrane/

Alex

From: Michael Lewis <m...@lew42.com>
> To: es-discuss@mozilla.org
> Cc:
> Bcc:
> Date: Thu, 30 Mar 2017 13:50:07 -0500
> Subject: Proxies fail comparison operator
> Hello community,
>
> The proxy is almost an identical to the underlying object, but it* fails
> a comparison check with the underlying object.*
>
> This means that if anyone gets a reference to the underlying object before
> it is proxied, then we have a problem.  For example:
>
> var obj = {};
> var proxy = new Proxy(obj, {});
> obj == proxy; // false
>
> *Isn't the purpose of the proxy to be exchanged with the original**,
> without any negative side effects?  *Maybe that's not the intended use
> case, but it's a useful one.  And, besides the comparison, I can't think of
> any other "negative side effects".
>
> It seems like the Proxy could have a *comparison trap*.  The comparison
> could pass by default, and you could use the trap if you wanted to make
> `proxy == obj` fail.
>
> Also, a slight tangent: it would be awesome if you could *skip debugging
> proxy traps when stepping through code.  *When you proxy both `get` and
> `apply` for all objects/methods, you have 10x the work when trying to step
> through your code.
>
> I just subscribed to this list.  Is this an appropriate venue for this
> type of inquiry?  I appreciate any feedback.
>
>
>
> Thanks!
>
> Michael
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to