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 descrive 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:
(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.
(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.]
Some modules are included in the Guile distribution; here are references to the entries in this manual which describe them in more detail:
Go to the first, previous, next, last section, table of contents.