chickadee » module-declarations

module-declarations

Description

Extends CHICKEN's declaration mechanism with forms for controlling modules, imports and exports.

The source for this egg is available here.

Requirements

Usage

module-declarations should be loaded as a compiler extension with the -extend (or -X) flag to csc:

   $ csc -extend module-declarations <file>

API

When extended, module-declarations adds three declaration specifiers, module, import, and export. These correspond to the module forms of the same names.

module
[declaration specifier] (module name)

Wraps the current file in a (module ...) form.

Modules declared in this way implicitly import the scheme and chicken units before any others.

If more than one module declaration is provided, the one appearing last takes precendence.

import
[declaration specifier] (import library ...)

Loads the given libraries into the current module using require-extension semantics.

If no module is declared, this specifier has no effect.

import-for-syntax
[declaration specifier] (import-for-syntax library ...)

Loads the given libraries into the current module using require-extension-for-syntax semantics.

If no module is declared, this specifier has no effect.

export
[declaration specifier] (export identifier ...)

Registers the given identifiers as exports of the current module, as with export.

If no module is declared, this specifier has no effect.

Example

(declare (module alphabet-soup)
         (import abc def ghi)
         (export uvw xyz))

; module content follows...

Author

Evan Hanson

License

Copyright (c) 2014-2016, 3-Clause BSD.