Relationship between globals, Realms, and global environment records

Allen Wirfs-Brock allen at wirfs-brock.com
Mon Nov 24 16:51:40 PST 2014


On Nov 24, 2014, at 7:11 AM, Anne van Kesteren wrote:

> On Sat, Nov 22, 2014 at 10:42 PM, Boris Zbarsky <bzbarsky at mit.edu> wrote:
>> On 11/22/14, 6:20 AM, Anne van Kesteren wrote:
>>> I thought these to be 1:1:1, but e.g. HTML defines the document.open()
>>> API
>>> https://html.spec.whatwg.org/multipage/webappapis.html#dom-document-open
>>> which replaces the global object. It's not currently defined in
>>> excruciating detail, but I suspect it will be at some point since
>>> content depends on this working.
>>> 
>>> Should that affect the Realm and global environment record?
>> 
>> Yes, imo.
> 
> I filed https://www.w3.org/Bugs/Public/show_bug.cgi?id=27419 to track
> this on the HTML side.
> 

There is definite a 1:1:1 relationship between a global object, realmRec, global environment record.  And  ES views those relationships are immutable.  You can't just change the global object of a realmRec or give it a different global environment record after it has been initialized.

Note that the ES6 spec. defines InitializeFirstRealm [1] that define how the first Realm gets created.  Creating additional realms would have to perform a similar set of steps.

Subsequent to the ES6 spec. we will be defining a ES level Realm object and associated API that supports creation and initialization of additional realms. 

Allen

[1] http://people.mozilla.org/~jorendorff/es6-draft.html#sec-initializefirstrealm 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141124/1c4bee4e/attachment.html>


More information about the es-discuss mailing list