Next: , Previous: Command levels, Up: Command processor


2.4.6 Module commands

Scheme48's command processor is well-integrated with its module system. It has several dedicated environments, including the user package and the config package, and can be used to evaluate code within most packages in the Scheme48 image during program development. The config package includes bindings for Scheme48's configuration language; structure & interface definitions may be evaluated in it. The command processor also has provisions to support rapid development and module reloading by automatically updating references to redefined variables in compiled code without having to reload all of that code.

— command: ,open struct ...

Opens each struct into the interaction environment, making all of its exported bindings available. This may have the consequence of loading code to implement those bindings. If there was code evaluated in the interaction environment that referred to a previously undefined variable for whose name a binding was exported by one of these structures, a message is printed to the effect that that binding is now available, and the code that referred to that undefined variable will be modified to subsequently refer to the newly available binding.

— command: ,load-package struct

— command: ,reload-package struct

,load-package and ,reload-package both load the code associated with the package underlying struct, after ensuring that all of the other structures opened by that package are loaded as well. ,load-package loads the code only if has not already been loaded; ,reload-package unconditionally loads it.

— command: ,user
— command: ,user command-or-exp
— command: ,config
— command: ,config command-or-exp
— command: ,for-syntax
— command: ,for-syntax command-or-exp
— command: ,new-package
— command: ,in structure
— command: ,in structure command-or-exp

These all operate on the interaction environment. `,user' sets it to the user package, which is the default at initial startup. `,user command-or-exp' temporarily sets the interaction environment to the user package, processes command-or-exp, and reverts the interaction environment to what it was before ,user was invoked. The ,config & ,for-syntax commands are similar, except that they operate on the config package and the package used for the user package's macros (see Macros in concert with modules). `,new-package' creates a temporary, unnamed package with a vanilla R5RS environment and sets the interaction environment to it. That new package is not accessible in any way except to the user of the command processor, and it is destroyed after the user switches to another environment (unless the user uses the ,structure command; see below). `,in structure' sets the interaction environment to be structure's package; structure is a name whose value is extracted from the config package. `,in structure command-or-exp' sets the interaction environment to structure temporarily to process command-or-exp and then reverts it to what it was before the use of ,in. Note that, within a structure, the bindings available are exactly those bindings that would be available within the structure's static code, i.e. code in the structure's begin package clauses or code in files referred to by files package clauses.

— command: ,user-package-is struct
— command: ,config-package-is struct

,user-package-is & ,config-package-is set the user & config packages, respectively, to be struct's package. Struct is a name whose value is accessed from the current config package.

— command: ,structure name interface

This defines a structure named name in the config package that is a view of interface on the current interaction environment.