[previous] [up] [next]     [contents] [index]
Next: Library Functions Up: MzScheme Architecture Previous: Library Functions

Scheme Namespaces (Top-Level Environments)

A Scheme namespace (a top-level environment) is represented by a value of type Scheme_Env * (although it is also a Scheme value). Calling scheme_basic_env returns a namespace that includes all of MzScheme's standard global procedures and syntax.

The scheme_basic_env function must be called once by an embedding program, before any other MzScheme function is called (except scheme_make_param). The returned namespace is the initial current namespace for the main MzScheme thread. MzScheme extensions cannot call scheme_basic_env.

The current thread's current namespace is available from scheme_get_env, given the current parameterization (see section 3.8): scheme_get_env(scheme_config).

New values can be added as globals in a namespace using scheme_add_global. The scheme_lookup_global function takes a Scheme symbol and returns the global value for that name, or NULL if the symbol is undefined.





PLT