Tech talk on proxies and traits

Oliver Hunt oliver at apple.com
Sat May 1 13:40:45 PDT 2010


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 ;)

--Oliver


More information about the es-discuss mailing list