Next: , Previous: Creating Guile Modules, Up: The Guile module system


5.16.3.4 Module System Reflection

The previous sections have described a declarative view of the module system. You can also work with it programmatically by accessing and modifying various parts of the Scheme objects that Guile uses to implement the module system.

At any time, there is a current module. This module is the one where a top-level define and similar syntax will add new bindings. You can find other module objects with resolve-module, for example.

These module objects can be used as the second argument to eval.

— Scheme Procedure: current-module

Return the current module object.

— Scheme Procedure: set-current-module module

Set the current module to module and return the previous current module.

— Scheme Procedure: resolve-module name

Find the module named name and return it. When it has not already been defined, try to auto-load it. When it can't be found that way either, create an empty module. The name is a list of symbols.

— Scheme Procedure: resolve-interface name

Find the module named name as with resolve-module and return its interface. The interface of a module is also a module object, but it contains only the exported bindings.

— Scheme Procedure: module-use! module interface

Add interface to the front of the use-list of module. Both arguments should be module objects, and interface should very likely be a module returned by resolve-interface.