previous up next     contents index
Next: Units Up: Programming Constructs Previous: Utilities

Global Variable Namespaces

 

MzScheme supports multiple global variable namespaces . A new namespace is created through the procedure make-eval, which returns an eval procedure that works in a new global variable namespace. A namespace is not a first-class value.

  (make-eval flag tex2html_wrap_inline8722 ) creates a new namespace with optional; flags are options adjust MzScheme's running mode in the new namespace. Any number of flags can be specified, where each flag is one of the following symbols:

Applications embedding MzScheme may extend this list of flags. (MrEd adds the 'wx flag for installing the wxWindows library.) If two conflicting flags are provided, the latter flag takes precedence. If any other value or symbol is provided as a flag, the  exn:application:type exception is raised. The default mode settings are built into the executable running MzScheme.

All primitive procedures are closed over a namespace. When make-eval creates a new namespace, it creates new versions of all of the primitive procedures. Every closure is also closed over the namespace where it is compiled. Thus, the body of a procedure always executes in a particular namespace, regardless of the namespace in which the procedure application was executed.

            Each namespace has its own current input and output ports (see section 2.18), evaluation handler (see section 3.8), load handler (see section 3.9), print handler (see section 3.10), error display handler (see section 3.12), debug info handler (see section 3.14), prompt read handler (see section 3.11), exit handler (see section 3.15), and user break polling handler (see section 3.16). A new namespace's handlers are set to the default handlers and the current ports are initially set to the current ports of the make-eval's namespace.


previous up next     contents index
Next: Units Up: Programming Constructs Previous: Utilities

PLT