The frozen realm spec provides only the per-realm evaluators eval and Function. An immutable root realm also provides these as well as the unnamed intrinsics GeneratorFunction, AsyncFunction, AsyncGeneratorFunction, ... . The *Function evaluators do not concern us here. The eval function evaluates code as "eval code". The ECMAScript spec also provides for code to be evaluated as "global code" but it provides no standard API to do so. Only hosts provide ways to evaluate code as global code, and only in host-specific ways. In the browser, the contents of script tags are evaluated approximately as global code.
Without an evaluator that evaluates code as global code, one cannot easily build on frozen realms a good emulation of these host environments. This issue should probably be addressed by the underlying Realms API proposal and then used by frozen realms. But either way, frozen realms need some way to do this.
The frozen realm spec provides only the per-realm evaluators
eval
andFunction
. An immutable root realm also provides these as well as the unnamed intrinsicsGeneratorFunction
,AsyncFunction
,AsyncGeneratorFunction
, ... . The*Function
evaluators do not concern us here. Theeval
function evaluates code as "eval code". The ECMAScript spec also provides for code to be evaluated as "global code" but it provides no standard API to do so. Only hosts provide ways to evaluate code as global code, and only in host-specific ways. In the browser, the contents ofscript
tags are evaluated approximately as global code.Without an evaluator that evaluates code as global code, one cannot easily build on frozen realms a good emulation of these host environments. This issue should probably be addressed by the underlying Realms API proposal and then used by frozen realms. But either way, frozen realms need some way to do this.
See https://github.com/FUDCo/proposal-frozen-realms/wiki/Differences-between-SES,-SES5,-and-ES5#top-level-declarations