[previous] [up] [next]     [contents] [index]
Next: Global Names Up: Threads and Namespaces Previous: Semaphores

Global Variable Namespaces

MzScheme supports multiple global variable namespaces. A new namespace is created with the make-namespace procedure, which returns a first-class namespace value. A namespace is used by setting the current-namespace parameter value (see section 9.4.1.6).

The current namespace is used by eval, load, compile, and expand-defmacro.[footnote] Once an expression is evaled or compiled, the global variable references in the compiled expression are permanently attached to a particular namespace, so the current namespace at the time that the code is executed is not used as the namespace for referencing global variables in the expression.

(make-namespace flag tex2html_wrap_inline12550 ) creates a new namespace; flags are options that determine the kinds of global names that are initially bound 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 low-level wx: GUI library.) If 'empty is provided, all other provided flags are ignored. Otherwise, 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 settings are built into the executable running MzScheme.

(namespace? v) returns #t if v is a namespace value, #f otherwise.




[previous] [up] [next]     [contents] [index]
Next: Global Names Up: Threads and Namespaces Previous: Semaphores

PLT