Re: Figuring out easier readonly interfaces

On Wed, Oct 2, 2013 at 2:47 PM, Jonas Sicking <jonas@sicking.cc> wrote:
> On Wed, Oct 2, 2013 at 2:43 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>> On 10/2/13 5:36 PM, Boris Zbarsky wrote:
>>>
>>> Say you had a readonly<Node> and you got the "id" setter off
>>> Element.prototype and called it.  What would happen, and why?
>>
>> Or readonly<Element> if you prefer.
>
> I think we'd try to convert the thisArg to a Element, which would fail
> since it's a proxy and not a Element. The setter would then throw.
>
> Of course, by that logic grabbing the "id"-getter from a Element and
> applying it to the proxy would fail for the same reason, which could
> be bad.
>
> I guess one question is, does readonly<Element>.prototype.id have the
> same getter as Element.prototype.id?

Under the explanation I gave, yes.  Both of them return the same
object from the ".prototype" [[Get]], and so they'll of course return
the same getter from .id.

~TJ

Received on Wednesday, 2 October 2013 21:51:12 UTC