Re: Figuring out easier readonly interfaces

On Wed, Oct 2, 2013 at 2:36 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 10/2/13 5:31 PM, Tab Atkins Jr. wrote:
>> And, regardless of what that method does, if it tries to mutate the
>> proxy, it'll run into one of the intercepted traps.
>
> No.  What that method does for, say, a getter is extract the underlying
> object that actually has the state (the C++ object in the case of Gecko and
> Blink and WebKit, for example) and modify _that_.

It's doing that outside of ES, then.  Within ES, there shouldn't be
any way to pierce the Proxy boundary unless you do it on purpose.
It's not very fair to ask me to explain how to implement something in
ES, and then point out that since it's not actually implemented in ES
none of my ideas can possible work. :/

> Let's do a concrete example to illustrate.
>
> Say you had a readonly<Node> and you got the "id" setter off
> Element.prototype and called it.  What would happen, and why?

What *should* happen is that it tries to set "id" on the Node
instance, which gets intercepted and cancelled.  If Node and Element
were implement in ES, that's what would happen.

~TJ

Received on Wednesday, 2 October 2013 21:43:36 UTC