W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2012

Re: variable declarations shadowing named properties on window

From: Cameron McCormack <cam@mcc.id.au>
Date: Sat, 07 Jan 2012 15:35:05 +1100
Message-ID: <4F07CB79.4060105@mcc.id.au>
To: Allen Wirfs-Brock <allen@wirfs-brock.com>
CC: Boris Zbarsky <bzbarsky@MIT.EDU>, Ojan Vafai <ojan@chromium.org>, Travis Leithead <travis.leithead@microsoft.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>, Ian Hickson <ian@hixie.ch>, Jeff Walden <jwalden@MIT.EDU>
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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:46 UTC