There is a invisible global object exists in script context (both JavaScript and ReoScript). As you know we could reference an object named 'window' in JavaScript anywhere even we haven't create it. The global object created by script engine automatically.
    window.onload = function() { };

    function check_window() {
        if (window.opener != null) { }

Usually the name of global object could be ignored when it be accessing.
    debug.assert( window.opener == opener );
    debug.assert( window.onload == onload );

Everything like variable and function defined in most outer scope (not called in function) will be stored and managed as property to the global object.
    var a = 10;                       // where is 'a'?
    debug.assert( window.a == a );    // 'a' belongs to 'window'

It's need to notice that the 'var' keyword only does not work when it be executed in most outer scope.
    var a = 10;                       // 'a' stored in global object
    function dummy() {
        var b = 10;                   // 'b' is local variable in function scope
    debug.assert( a == b )            // false: there is no 'b' existed

Same rule does apply even a function to be defined:
    function hello() {

It is same as:
    window.hello = function() { }

Global object named 'script' in ReoScript

Does not like JavaScript in Browsers since there is not a Window existed in ReoScript so the global object was be implemented with name 'script'.

In fact in most cases we don't need to use it by specifying its name explicitly. We could just ignore it.

Last edited Jul 11, 2013 at 2:17 AM by unvell, version 1