Proxy.isProxy (Was: using Private name objects for declarative property definition.)

Allen Wirfs-Brock allen at wirfs-brock.com
Wed Jul 13 08:31:13 PDT 2011


isProxy is definitely a meta-layer operation and you don't want it polluting the application layer.  However, when you doing proxy level meta programming I can imagine various situations where you might need to determine whether or not an object is a proxy.  I think it should exist, but should exist in a namespace that is clearly part of the meta-layer.  Arguably Proxy, itself, is such a namespace.  But if there is fear that it is too close to the app layer then we might hand it from Proxy.Handler or something else that is clearly on the meta side.  Or have a Proxy support modules.

Allen





On Jul 13, 2011, at 2:07 AM, David Bruant wrote:

> And in general, the main use case for proxies is to emulate host objects. If there is a language construct that helps separating the two cases, we're going against this use case.
> 
> David
> 
> Le 13/07/2011 10:26, Andreas Gal a écrit :
>> 
>> 
>> I really don't think IsProxy is a good idea. It can lead to subtle bugs depending on whether an object is a DOM node, or a wrapper around a DOM node (or whether the embedding uses a proxy to implement DOM nodes or not). In Firefox we plan on making some DOM nodes proxies for example, but not others. I really don't think there is value in exposing this to programmers.
>> 
>> Andreas
>> 
>> On Jul 13, 2011, at 1:23 AM, Tom Van Cutsem wrote:
>> 
>>> Perhaps Proxy.isProxy was used merely as an example, but wasn't the consensus that Proxy.isProxy is not needed? Dave pointed out that it breaks transparent virtualization. Also, there is Object.isExtensible which always returns |true| for (trapping) proxies. That means we already have "half" of Proxy.isProxy without exposing proxies: if !Object.isExtensible(obj), obj is guaranteed not to be a proxy.
>>> 
>>> Cheers,
>>> Tom
>>> 
>>> 2011/7/9 Brendan Eich <brendan at mozilla.com>
>>> Also the Proxy.isTrapping, which in recent threads has been proposed to be renamed to Proxy.isProxy or Object.isProxy.
>>> 
>>> _______________________________________________
>>> es-discuss mailing list
>>> es-discuss at mozilla.org
>>> https://mail.mozilla.org/listinfo/es-discuss
>> 
>> 
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110713/209bf4b1/attachment-0001.html>


More information about the es-discuss mailing list