Scheme 48 Manual | Contents | In Chapter: Module system
Previous: Command processor support | Next: Discussion

Configuration packages

It is possible to set up multiple configuration packages. The default configuration package opens the following structures:

Note that it does not open scheme.

You can define additional configuration packages by making a package that opens module-system and, optionally, built-in-structures, more-structures, or other structures that export structures and interfaces.

For example:

> ,config (define-structure foo (export)
            (open module-system
                  built-in-structures
                  more-structures))
> ,in foo
foo> (define-structure x (export a b)
       (open scheme)
       (files x))
foo> 

Unfortunately, the above example does not work. The problem is that every environment in which define-structure is defined must also have a way to create "reflective towers" (a misnomer; a better name would be "syntactic towers"). A new reflective tower is required whenever a new environment is created for compiling the source code in the package associated with a new structure. The environment's tower is used at compile time for evaluating the macro-source in

(define-syntax name macro-source)
(let-syntax ((name macro-source) ...) body)
and so forth. It is a "tower" because that environment, in turn, has to say what environment to use if macro-source itself contains a use of let-syntax.

The simplest way to provide a tower maker is to pass on the one used by an existing configuration package. The special form export-reflective-tower creates an interface that exports a configuration package's tower. The following example uses export-reflective-tower and the ,structure command to obtain a tower maker and create a new configuration environment.

> ,config ,structure t (export-reflective-tower-maker)
> ,config (define-structure foo (export)
            (open module-system
                  t
                  built-in-structures
                  more-structures))

Previous: Command processor support | Next: Discussion