Re: variable declarations shadowing named properties on window

On 1/4/12 4:31 PM, Travis Leithead wrote:
> When you say "proxy" I assume you think that there are actually two objects, a "native object" and a "proxy object".

No, I'm just thinking there's something that can implement the various 
internal methods of ES directly, however it does that.

>> It really sounds like the behavior IE has here is not actually
>> describable in terms of the ES spec (even with proxies, if I understand
>> it correctly) as things stand...
>
> Not having a good understanding of ES proxies, I can't comment on that.

I believe the relevant parts of the spec go as follows.

For "var x", I believe the relevant section of ES 5 is 10.5.  Per step 
8, HasBinding is called.  HasBinding for the case when the environment 
is the global object is defined in section 10.2.1.2.1, and simple calls 
the [[HasProperty]] internal method.  If this returns true, then the var 
statement is supposed to be ignored per 10.5 step 8c.

So if we posit that IE is actually implementing this spec as written 
(which I sort of doubt; I don't think anyone is at the moment) 
presumably in IE [[HasProperty]] here returns false for properties that 
come from the GSP given the observed var behavior.

But then that would imply that other places that use [[HasProperty]] 
would need to return false too: the [[HasProperty]] call is not told 
that it's happening for a var binding.

In particular, I believe that would make the HasBinding concrete method 
return false for all GSP properties on the window, which means they 
couldn't be looked up as barewords.  But I could be misreading the spec, 
of course...

-Boris

Received on Thursday, 5 January 2012 00:55:38 UTC