Re: variable declarations shadowing named properties on window

On 1/5/12 9:44 PM, Allen Wirfs-Brock wrote:
> I believe that this is the change Boris is referring to:
> https://bugs.ecmascript.org/show_bug.cgi?id=78

Yes, thank you.  Any chance of the revised text making it to a spec 
somewhere where people might see it (and maybe even fix existing 
implementations)?  ;)

In any case, the updated text says that if HasBinding returns true then 
the implementation should call [[GetOwnProperty]] on the global.  If 
this returns undefined, then [[DefineOwnProperty]] is called on the 
global with the property descriptor: {[[Value]]: undefined, 
[[Writable]]: true, [[Enumerable]]: true , [[Configurable]]: 
configurableBindings }.

So now to make var shadow some property that property needs to either 
return false from HasBinding or return undefined from [[GetOwnProperty]].

Cameron, can GSP properties return undefined from [[GetOwnProperty]] but 
still do what they should for window.foo and bareword lookups without 
other things elsewhere breaking?

-Boris

Received on Friday, 6 January 2012 05:50:38 UTC