Re: Question about implements statements

On 6/15/12 6:24 PM, Travis Leithead wrote:
> First of all, changing an instance's internal prototype is not legit ECMAScript.

Yes, yes.  But I didn't remember the property descriptor boilerplate 
offhand.  The effect is the same.

> Beyond that, the getter (or setter) always has to validate the "this" value
> whenever it is invoked because you can always "bind" or "call" the method
> with _any_ this value.

Yes, of course.  The question is what values of "this" should be valid 
for web APIs.

> Off topic: Usually interfaces that are right-hand-side targets for the implements statement
> Are marked with [NoInterfaceObject] so that you don't typically see this problem

That doesn't help in my example.  Setting C as [NoInterfaceObject] does 
not prevent someone from grabbing a getter from an instance of A and 
calling it on an instance of B.  The question is whether that should 
throw or "work".  The spec right now is somewhere between ambiguous and 
"work".  I would prefer that it said "throw".

-Boris

Received on Friday, 15 June 2012 22:44:34 UTC