{"action":"created","issue":{"url":"https://api.github.com/repos/babel/babel/issues/868","labels_url":"https://api.github.com/repos/babel/babel/issues/868/labels{/name}","comments_url":"https://api.github.com/repos/babel/babel/issues/868/comments","events_url":"https://api.github.com/repos/babel/babel/issues/868/events","html_url":"https://github.com/babel/babel/issues/868","id":58529223,"number":868,"title":"Intent to support Realm based intrinsics","user":{"login":"jonathanKingston","id":338988,"avatar_url":"https://avatars.githubusercontent.com/u/338988?v=3","gravatar_id":"","url":"https://api.github.com/users/jonathanKingston","html_url":"https://github.com/jonathanKingston","followers_url":"https://api.github.com/users/jonathanKingston/followers","following_url":"https://api.github.com/users/jonathanKingston/following{/other_user}","gists_url":"https://api.github.com/users/jonathanKingston/gists{/gist_id}","starred_url":"https://api.github.com/users/jonathanKingston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonathanKingston/subscriptions","organizations_url":"https://api.github.com/users/jonathanKingston/orgs","repos_url":"https://api.github.com/users/jonathanKingston/repos","events_url":"https://api.github.com/users/jonathanKingston/events{/privacy}","received_events_url":"https://api.github.com/users/jonathanKingston/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2015-02-22T23:52:46Z","updated_at":"2015-02-23T01:24:36Z","closed_at":"2015-02-23T00:50:33Z","body":"As mentioned in: https://github.com/switchfly/ember-cli-mocha/issues/37#issuecomment-75465220 the ECMA6 specification suggests that all intrinsic objects to the browser should be defined based upon their realm and each modules define a new realm.\r\n\r\n> From my quick scrambling through the ES6 spec (I'm probably not reading this right).\r\n\r\n> [Object Environment Records](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records)\r\n>> Immutable bindings do not exist for object environment records.\r\n\r\n> So no help there, however I believe that is just describing normal behaviour of scripts.\r\n\r\n> ---\r\n\r\n> [Well known intrinsic objects](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-well-known-intrinsic-objects)\r\n\r\n>>  Unless otherwise specified each intrinsic object actually corresponds to a set of similar objects, one per Realm.\r\n\r\n> [Code Realms](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms)\r\n\r\n>> Before it is evaluated, all ECMAScript code must be associated with a Realm. Conceptually, a realm consists of a set of intrinsic objects, an ECMAScript global environment\r\n> From my quick scrambling through the ES6 spec (I'm probably not reading this right).\r\n\r\n> [Object Environment Records](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-environment-records)\r\n>> Immutable bindings do not exist for object environment records.\r\n\r\n> So no help there, however I believe that is just describing normal behaviour of scripts.\r\n\r\n> ---\r\n\r\n> [Well known intrinsic objects](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-well-known-intrinsic-objects)\r\n\r\n>>  Unless otherwise specified each intrinsic object actually corresponds to a set of similar objects, one per Realm.\r\n\r\n> [Code Realms](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-code-realms)\r\n\r\n>> Before it is evaluated, all ECMAScript code must be associated with a Realm. Conceptually, a realm consists of a set of intrinsic objects, an ECMAScript global environment\r\n\r\n> [Module evaluation](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-moduleevaluation)\r\n>> Set the Realm of moduleCxt to module.[[Realm]].\r\n\r\n> ---\r\n\r\n>My reading of that is `Object` is considered an **Intrinsic** object which is related to the **Realm** it is in, Modules appear to run in their own **Realm**. Creating a new **Realm** appears to reinstantiate new Intrinsics.\r\n\r\n\r\nindex.js\r\n```\r\nimport me from './other';\r\nimport me2 from './other2';\r\n\r\nconsole.log('Test1: ' + String.prototype.thing);\r\n```\r\n\r\nother.js\r\n```\r\nObject.prototype.thing = 'Shoe';\r\n\r\nvar test = [];\r\n\r\nexport default test;\r\n```\r\n\r\nother2.js\r\n```\r\nconsole.log('Test2: ' + String.prototype.thing);\r\n```\r\n\r\n```\r\nbabel *.js -d out/\r\n```\r\n\r\n```\r\nnode out/index.js\r\nTest2: Shoe\r\nTest1: Shoe\r\n```\r\n\r\nIf I am reading the spec correctly, the above code both should return `undefined` not `Shoe`"},"comment":{"url":"https://api.github.com/repos/babel/babel/issues/comments/75477901","html_url":"https://github.com/babel/babel/issues/868#issuecomment-75477901","issue_url":"https://api.github.com/repos/babel/babel/issues/868","id":75477901,"user":{"login":"jonathanKingston","id":338988,"avatar_url":"https://avatars.githubusercontent.com/u/338988?v=3","gravatar_id":"","url":"https://api.github.com/users/jonathanKingston","html_url":"https://github.com/jonathanKingston","followers_url":"https://api.github.com/users/jonathanKingston/followers","following_url":"https://api.github.com/users/jonathanKingston/following{/other_user}","gists_url":"https://api.github.com/users/jonathanKingston/gists{/gist_id}","starred_url":"https://api.github.com/users/jonathanKingston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonathanKingston/subscriptions","organizations_url":"https://api.github.com/users/jonathanKingston/orgs","repos_url":"https://api.github.com/users/jonathanKingston/repos","events_url":"https://api.github.com/users/jonathanKingston/events{/privacy}","received_events_url":"https://api.github.com/users/jonathanKingston/received_events","type":"User","site_admin":false},"created_at":"2015-02-23T01:24:36Z","updated_at":"2015-02-23T01:24:36Z","body":"@sebmck no sorry Ember extends array and function prototypes also.\r\n\r\nYeah you can turn it off, which I think might be the correct stance for ember-cli apps given the very justified limitation here."}}