Relationship between globals, Realms, and global environment records
Allen Wirfs-Brock
allen at wirfs-brock.com
Tue Nov 25 11:17:05 PST 2014
On Nov 25, 2014, at 11:06 AM, Boris Zbarsky wrote:
> On 11/25/14, 2:02 PM, Allen Wirfs-Brock wrote:
>> I know, I don't see how in you example to rationalize (using ES concepts) that 'self.x' evaluate to undefined and but 'x' evaluates to 'test'.
>
> "x" is doing a lookup on the global.
>
> "self" is a proxy whose target is not that global but some other object.
OK, I think I got it.
You're saying that, for a Realm, the global object never changes, but that the (initial values) of 'window', 'self', 'document'(??) etc. are proxies (all the same one?) whose target can dynamically change.
So, yes, that seems to explain things. It also means that Anne's original question about "replacing the global" object seems to be relevant as the actual global object binding never changes.
Allen
More information about the es-discuss
mailing list