Re: variable declarations shadowing named properties on window

Allen Wirfs-Brock:
> I assume by "barewood" you mean an unqualified global reference to
> foo.  Such a reference calls HasBinding on the global environment
> record.   This is defined to be equivalent to calling the
> [[HasProperty]] internal method of the global object.  Note that
> [[HasProperty]] for normal objects essentially tests the result of
> [[GetProperty]] for undefined.  window.foo does a [[Get]] on the
> global object.  The normal definition of [[Get]] also uses
> [[GetProperty]].  So both window.foo and bareword foo both use
> [[GetProperty]] in essentially the same way.  I don't see why there
> would be any difference in their behaviors.

If you're using the normal definition of [[Get]].  In my response to 
Boris I was supposing that we would require a custom [[Get]] that 
returns the named property value, despite [[GetProperty]] returning 
undefined for it, and pointing out that that isn't sufficient to allow 
unqualified references to the named properties to resolve.

Received on Saturday, 7 January 2012 04:35:54 UTC