W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2013

Re: Figuring out easier readonly interfaces

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 2 Oct 2013 14:42:49 -0700
Message-ID: <CAAWBYDAbxPpOJDwFd_mkLbgzPsX-z0dDq0-S+XjCXzq-c=jAbA@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: "public-script-coord@w3.org" <public-script-coord@w3.org>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:18 UTC