Tech talk on proxies and traits

Brendan Eich brendan at mozilla.com
Sat May 1 15:25:15 PDT 2010


On May 1, 2010, at 1:40 PM, Oliver Hunt wrote:

> On May 1, 2010, at 1:27 PM, Brendan Eich wrote:
>>> A simple solution that would allow maintaining the
>>> above mentioned 'invariant' in most cases and allow breaking it when
>>> necessary would involve a flag passed into the 'get' handler
>>> indicating that the property is about to be 'called'.  What would be
>>> the negative ramifications of such a solution (asides from the fact
>>> that it may get abused - like the 'get' accessor in es5 ;)?
>>
>> This is a good idea. In all practical implementations, callee  
>> expressions are specialized so the "get" can tell it is computing a  
>> callee. This is done to bind |this| in the call expression of which  
>> the callee expression is a left prefix.
>
> [[Get]] in JavaScriptCore does not distinguish the get for a.b vs  
> a.b(), i like to imagine that we count as being a practical  
> implementation ;)

My mistake, I thought JSC did. How do you compute |this| for the call?  
I mean, |this| binds to whatever |a| evaluated to, and it evaluates  
only once, so *something* differs in how you compile a.b in an  
expression such as (x = a.b) or (a.b + c.d) vs. how you compile a.b in  
a.b().

/be


More information about the es-discuss mailing list