You are looking at historical revision 13621 of this page. It may differ significantly from its current revision.
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.
[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 ...)
[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.
[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).
[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.
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.
- added support for modules with empty export lists
- begin bodies missed initial begin during pre-expansion
- fixed buggy handling of include
- added srfi-89 support
- supports curried define syntax
- added support for syntactic-closures
- added import*
- added codewalk requirement to meta file
- import is now also allowed outside of module form
- initial release