[[tags: egg]] == module-declarations [[toc:]] === Description Extends CHICKEN's [[/manual/Declarations|declaration]] mechanism with forms for controlling modules, imports and exports. The source for this egg is available [[https://git.foldling.org/chicken-module-declarations.git|here]]. ==== Requirements * [[/egg/matchable|matchable]] * [[/egg/srfi-1|srfi-1]] === Usage {{module-declarations}} should be loaded as a compiler extension with the {{-extend}} (or {{-X}}) flag to {{csc}}: $ csc -extend module-declarations ==== API When extended, {{module-declarations}} adds four declaration specifiers, [[#module|{{module}}]], [[#import|{{import}}]], [[#import-for-syntax|{{import-for-syntax}}]], and [[#export|{{export}}]]. These correspond to the [[/manual/Modules|module forms]] of the same names. ===== module [declaration specifier] (module name) Wraps the current file in a [[/manual/Modules#module|{{(module ...)}}]] form. Modules declared in this way implicitly import the same libraries that are available at the top level. 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 module. 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 module at expansion time. If no {{module}} is declared, this specifier has no effect. ===== export [declaration specifier] (export identifier ...) Registers the given identifiers as exports of the module. If no {{module}} is declared, this specifier has no effect. ==== Example (declare (module alphabet-soup) (import a b c) (export x y z)) ; module content follows... === Author [[/users/evan-hanson|Evan Hanson]] === License Copyright (c) 2014-2018, 3-Clause BSD.