The Guile module system
=======================
In 1996 Tom Lord implemented a full-featured module system for Guile
which allows loading Scheme source files into a private name space.
This module system is regarded as being rather idiosyncratic, and will
probably change to something more like the ML module system, so for now
I will simply describe how it works for a couple of simple cases.
First of all, the Guile module system sets up a hierarchical name space,
and that name space can be represented like Unix pathnames preceded by a
<#> character. The root name space for all Guile-supplied modules is
called `ice-9'.
So for example, the SLIB interface, contained in
`$srcdir/ice-9/slib.scm', starts out with
(define-module (ice-9 slib))
and a user program can use
(use-modules (ice-9 slib))
to have access to all procedures and variables defined within the slib
module with `(define-public ...)'.
So here are the functions involved:
- syntax: define-module module-specification
MODULE-SPECIFICATION is of the form `(hierarchy file)'. One
example of this is
(use-modules (ice-9 slib))
define-module makes this module available to Guile programs under
the given MODULE-SPECIFICATION.
- syntax: define-public ...
Makes a procedure or variable available to programs that use the
current module.
- syntax: use-modules module-specification
MODULE-SPECIFICATION is of the form `(hierarchy file)'. One
example of this is
(use-modules (ice-9 slib))
use-modules allows the current Guile program to use all publicly
defined procedures and variables in the module denoted by
MODULE-SPECIFICATION.
[FIXME: must say more, and explain, and also demonstrate a private name
space use, and demonstrate how one would do Python's "from Tkinter
import *" versus "import Tkinter". Must also add something about paths
and standards for contributed modules.]
- primitive: standard-eval-closure module
Some modules are included in the Guile distribution; here are references
to the entries in this manual which describe them in more detail:
*boot-9*
boot-9 is Guile's initialization module, and it is always loaded
when Guile starts up.
*(ice-9 debug)*
Mikael Djurfeldt's source-level debugging support for Guile (Note:Debugger User Interface).
*(ice-9 threads)*
Guile's support for multi threaded execution (Note:Scheduling).
*(ice-9 slib)*
This module contains hooks for using Aubrey Jaffer's portable
Scheme library SLIB from Guile (Note:SLIB).
*(ice-9 jacal)*
This module contains hooks for using Aubrey Jaffer's symbolic math
packge Jacal from Guile (Note:JACAL).
automatically generated byinfo2wwwversion 1.2.2.9