Note: This is taken from the Chicken Wiki, where a more recent version could be available.

modules

A simple module system for use with the low-level (define-macro) and syntactic-closures macro systems. Import and export of macros is not allowed.

In combination with the -emit-exports compiler option, this module system provides some minimal interoperability with the (much more powerful) module system provided by the syntax-case extension.

When used with the syntax-case macro system, this extension does nothing.

Mote that any alternative macro expander (syntactic-closures, for example) must be loaded/required prior to using this extension, as it must be aware of the expander used.

module

[syntax] (module [NAME] (EXPORT ...) BODY ...)

Defines a named or anonymous module. The EXPORTs should be identifiers and name bindings exported by this module. The bindings must be defined (using define) in BODY, either at it's toplevel or nested in begin forms. If an exported binding is not defined, an error will be signalled. All other toplevel bindings defined in BODY will be hidden and not be accessible from outside of this module.

Definitions recognized are any of the following:

(define ID VAL)
(define (ID . LLIST) BODY ...)
(define* (ID . LLIST) BODY ...)
(define (... (ID . LLIST) ...) BODY ...)    ; "curried" define
(define* (... (ID . LLIST) ...) BODY ...)    ; "curried" define
(define-values (ID ...) VAL)
(include FILENAME)                ; recursively expands body
(cond-expand CLAUSE ...)

import

[syntax] (import NAME)

Imports exported bindings from the module with the name NAME. If a module with the required name was previously defined, then all the following expressions may access the imported bindings. If no module is known under this name, then an installed extension will be searched that exports identifiers that are qualified with NAME. If no such extension can be found, then a file named NAME.exports will be searched in the current include-path and qualified identifiers from it will be extracted. If neither an installed extension nor an .exports file lists any qualified export, then an error will be signalled.

If used inside a module form, then the imported bindings will only be accessible inside the lexical scope of the module. If used outside of a module form, then the values of imported bindings will be assigned to toplevel variables of the same name, overwriting any existing bindings.

import*

[syntax] (import* NAME IMP ...)

Imports selective with optional renaming. Only the identifiers given in IMP ... will be imported from the module NAME, where IMP may be either an identifier or a list of the form (NEW OLD).

export-toplevel

[syntax] (export-toplevel IDENTIFIER ...)

Exports the values given by the (possibly non-exported) module bindings IDENTIFIER ... as toplevel variables of the same name. IDENTIFIER may also be of the form (IDENTIFIER EXPORT), which exports the module binding IDENTIFIER as toplevel variable EXPORT.

Authors

felix winkelmann

Requirements

codewalk

miscmacros

License

Copyright (c) 2006-2007, Felix L. Winkelmann
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

 Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer. 
 Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the 
   documentation and/or other materials provided with the distribution. 
 Neither the name of the author nor the names of its contributors
   may be used to endorse or promote products derived from this
   software without specific prior written permission. 

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Version History

0.91
added support for modules with empty export lists
0.9
begin bodies missed initial begin during pre-expansion
0.8
fixed buggy handling of include
0.7
added srfi-89 support
0.6
supports curried define syntax
0.5
added support for syntactic-closures
0.4
added import*
0.3
added codewalk requirement to meta file
0.2
import is now also allowed outside of module form
0.1
initial release