Converting an existing object to a proxy

David Bruant david.bruant at labri.fr
Fri May 27 03:04:28 PDT 2011


Le 27/05/2011 11:35, Brendan Eich a écrit :
> On May 27, 2011, at 2:26 AM, David Bruant wrote:
>
>> Le 27/05/2011 04:13, Mark S. Miller a écrit :
>>> On Thu, May 26, 2011 at 5:04 PM, Cormac Flanagan <cormac at cs.ucsc.edu 
>>> <mailto:cormac at cs.ucsc.edu>> wrote:
>>>
>>>     [documenting/expanding some ideas briefly discussed at today's
>>>     meeting]
>>>
>>>     The current proxy proposal has a method to create a new proxy:
>>>
>>>     var proxy = Proxy.create(handler, proto);
>>>
>>>     We could extend this proposal to allow an existing object to be
>>>     converted to a proxy, via:
>>>
>>>     var proxy = Proxy.createFrom(object, handler, proto);
>>>
>> I am surprised by this proposal since a design goal of proxies was to 
>> not be able to turn existing objects into proxies.
>> 4th "driving force" of the proxy proposal:
>> "security: avoid enabling arbitrary ES objects to be able to 
>> intercept the properties of another object"
>
> That is not the same as "avoid turning an object into a proxy", though.
I actually thought that it's what it meant, but you're right. I think it 
should be clarify, because the way the API is design, it's quite clear 
that only new objects can be proxies. In the presentation you gave, it's 
clear that proxies can only go from "trapping" to "fixed" and that there 
is no way to go in the opposite direction

> The idea of permitting this "becomes" operation only for extensible 
> objects with configurable properties is crucial.
Is it? The first time I heard about the "become" operation was in the 
context of the proxy fix trap. Second time was this message. It doesn't 
sounds crucial yet to me.

> The motivation is to unify ideas in proxies (in Harmony) with those 
> proposed in http://wiki.ecmascript.org/doku.php?id=strawman:observe.
I hadn't read this proposal yet. Thanks.

I think that this discussion raises the following question:
Should all usages of the "become" operation be associated with proxies?

I would answer no because they sound like orthogonal concerns, but I'm 
interested in listening to arguments saying otherwise.

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110527/a28ed3f8/attachment.html>


More information about the es-discuss mailing list