
Next: Units
Up: Programming Constructs
Previous: Utilities
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
) 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:
- 'case-sensitive -- read in the new namespace
reads case-sensitive symbols.
- 'case-insensitive -- read in the new namespace
reads case-insensitive symbols.
- 'constants -- built-in procedures are constant
in the new namespace.
- 'no-constants -- built-in procedures are not constant
in the new namespace.
- 'keywords -- keywords are enforced in the new namespace.
- 'no-keywords -- keywords are not enforced in the new namespace.
- 'set!-undefined -- set! can
be used on undefined identifiers in the new namespace.
- 'no-set!-undefined -- set!
cannot be used on undefined identifiers in the new namespace.
- 'auto-else -- matching no clause in a cond
or case expression returns #<void> in the new namespace.
- 'no-auto-else -- matching no clause in a cond
or case expression raises the exn:else exception in the
new namespace.
- 'call/cc=call/ec -- call/cc captures an
escape-only continuation in the new namespace.
- 'call/cc!=call/ec -- call/cc captures a full
continuation in the new namespace.
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.

Next: Units
Up: Programming Constructs
Previous: Utilities
PLT