Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-13 Thread Tom Van Cutsem
2013/9/12 Mark S. Miller erig...@google.com Membranes need shadow targets, because of non-extensibility of objects and non-configurability of properties. This special case of no-invariants-anywhere is not JavaScript. Trying to do membranes without shadow targets is a useless exercise. True,

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-13 Thread David Bruant
Le 13/09/2013 09:19, Tom Van Cutsem a écrit : 2013/9/12 Mark S. Miller erig...@google.com mailto:erig...@google.com Membranes need shadow targets, because of non-extensibility of objects and non-configurability of properties. This special case of no-invariants-anywhere is not

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-13 Thread Tom Van Cutsem
2013/9/13 David Bruant bruan...@gmail.com If one wants Object.getPrototypeOf to return the same object twice, the membrane has to associate a new prototype with a given object. If there is a shadow target, the place of where to store this object is pretty obvious ([[Prototype]]). That said,

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-12 Thread Tom Van Cutsem
[+markm, allenwb] 2013/9/11 David Bruant bruan...@gmail.com Le 11/09/2013 16:22, Tom Van Cutsem a écrit : [[GetInheritance]] always checks whether the proxy and target's prototype are the same, but as you pointed out, if the target is extensible, you can set its prototype to some other

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-12 Thread Tom Van Cutsem
I'm willing to call them [[GetPrototypeOf]] and [[SetPrototypeOf]] to match the trap names. I prefer avoiding a direct connotation with the [[Prototype]] internal data property as an exotic object is not required to have one. I'm all for matching the internal method names with the trap and

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-12 Thread Mark S. Miller
On Thu, Sep 12, 2013 at 4:14 AM, Tom Van Cutsem tomvc...@gmail.com wrote: [+markm, allenwb] 2013/9/11 David Bruant bruan...@gmail.com Le 11/09/2013 16:22, Tom Van Cutsem a écrit : [[GetInheritance]] always checks whether the proxy and target's prototype are the same, but as you pointed

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-12 Thread David Bruant
Le 12/09/2013 15:35, Mark S. Miller a écrit : On Thu, Sep 12, 2013 at 4:14 AM, Tom Van Cutsem tomvc...@gmail.com mailto:tomvc...@gmail.com wrote: [+markm, allenwb] But more generally, you're right that it's odd [[GetInheritance]] is doing an invariant check on an otherwise

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-12 Thread Allen Wirfs-Brock
On Sep 12, 2013, at 6:35 AM, Mark S. Miller wrote: On Thu, Sep 12, 2013 at 4:14 AM, Tom Van Cutsem tomvc...@gmail.com wrote: [+markm, allenwb] 2013/9/11 David Bruant bruan...@gmail.com Le 11/09/2013 16:22, Tom Van Cutsem a écrit : [[GetInheritance]] always checks whether the proxy and

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-12 Thread Mark S. Miller
Membranes need shadow targets, because of non-extensibility of objects and non-configurability of properties. This special case of no-invariants-anywhere is not JavaScript. Trying to do membranes without shadow targets is a useless exercise. On Thu, Sep 12, 2013 at 8:03 AM, David Bruant

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-12 Thread Boris Zbarsky
On 9/12/13 11:03 AM, David Bruant wrote: If the code that runs against your membrane is not expected to be allowed to change extensiveness It's absolutely expected to be allowed to do that. You should be able to freeze objects coming from another global. -Boris

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-11 Thread Brendan Eich
Cc'ing Tom to make sure I tell no lies. Boris Zbarsky mailto:bzbar...@mit.edu September 10, 2013 9:10 PM Hey all, I was looking at implementing a membrane using ES6 proxies and ran into a snag. Consider a situation where object A has prototype B. A' is a proxy implementing the membrane,

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-11 Thread David Bruant
Le 11/09/2013 06:10, Boris Zbarsky a écrit : Hey all, I was looking at implementing a membrane using ES6 proxies and ran into a snag. Consider a situation where object A has prototype B. A' is a proxy implementing the membrane, whose target is A. But now if Object.getPrototypeOf(A') is

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-11 Thread David Bruant
Le 11/09/2013 06:10, Boris Zbarsky a écrit : I was looking at implementing a membrane using ES6 proxies May I ask why you've been working on that? Is it related to the work on WebIDL binding of DOM/browser objects? One design goal of proxies was getting closer to self-hostability of the

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-11 Thread Tom Van Cutsem
2013/9/11 David Bruant bruan...@gmail.com I think it was discussed at some point to get rid of the restriction on the getPrototypeOf trap and enforce it only for non-extensible objects (but I can't find the info anymore, I might just be inventing this...). It would allow you to return a

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-11 Thread Tom Van Cutsem
2013/9/11 David Bruant bruan...@gmail.com Le 11/09/2013 06:10, Boris Zbarsky a écrit : Hey all, I was looking at implementing a membrane using ES6 proxies and ran into a snag. Consider a situation where object A has prototype B. A' is a proxy implementing the membrane, whose target is

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-11 Thread David Bruant
Le 11/09/2013 16:22, Tom Van Cutsem a écrit : 2013/9/11 David Bruant bruan...@gmail.com mailto:bruan...@gmail.com I think it was discussed at some point to get rid of the restriction on the getPrototypeOf trap and enforce it only for non-extensible objects (but I can't find the info

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-11 Thread Boris Zbarsky
On 9/11/13 5:14 AM, David Bruant wrote: Le 11/09/2013 06:10, Boris Zbarsky a écrit : I was looking at implementing a membrane using ES6 proxies May I ask why you've been working on that? It came up in the context of a discussion about how to handle __proto__ sets on WebIDL objects in Gecko

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-11 Thread David Bruant
Le 11/09/2013 16:52, Boris Zbarsky a écrit : One design goal of proxies was getting closer to self-hostability of the DOM/browser APIs Yeah, I was basically thinking about how I'd do Gecko's cross-global wrappers with ES proxies (not that that's a reasonable thing to do, since it requires

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-11 Thread Boris Zbarsky
On 9/11/13 12:05 PM, David Bruant wrote: In a self-hosted implementation, one would have to re-implement the notion of current global and effective script origin for the content it runs. Ah, I see the issue. I'm interested in self-hosting parts of the runtime, not in emulating an entire

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-11 Thread Boris Zbarsky
On 9/11/13 11:23 AM, David Bruant wrote: Can you elaborate on these APIs? In particular, the API that changes the current global and effective script origin. That clearly can't be done from a script, since the global and effective script origin while a script is running have to be the

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-11 Thread Allen Wirfs-Brock
On Sep 11, 2013, at 8:53 AM, David Bruant wrote: Le 11/09/2013 17:51, Allen Wirfs-Brock a écrit : Ps: btw, wasn't GetInheritance supposed to be renamed GetPrototype? I think we had agreement on that. Allen? I'm willing to call them [[GetPrototypeOf]] and [[SetPrototypeOf]] to match

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-11 Thread David Bruant
Le 11/09/2013 17:45, Boris Zbarsky a écrit : On 9/11/13 11:23 AM, David Bruant wrote: Can you elaborate on these APIs? In particular, the API that changes the current global and effective script origin. That clearly can't be done from a script, since the global and effective script origin

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-11 Thread David Bruant
Le 11/09/2013 17:51, Allen Wirfs-Brock a écrit : Ps: btw, wasn't GetInheritance supposed to be renamed GetPrototype? I think we had agreement on that. Allen? I'm willing to call them [[GetPrototypeOf]] and [[SetPrototypeOf]] to match the trap names. I prefer avoiding a direct

Re: Implementing membranes using proxies, and [[GetInheritance]]

2013-09-11 Thread Allen Wirfs-Brock
On Sep 11, 2013, at 7:17 AM, Tom Van Cutsem wrote: 2013/9/11 David Bruant bruan...@gmail.com Le 11/09/2013 06:10, Boris Zbarsky a écrit : Hey all, I was looking at implementing a membrane using ES6 proxies and ran into a snag. Consider a situation where object A has prototype B. A'