source: project/wiki/eggref/4/module-declarations @ 33385

Last change on this file since 33385 was 33385, checked in by evhan, 3 years ago

egg-locations: Migrate my eggs from bitbucket.org to foldling.org

File size: 2.1 KB
Line 
1[[tags: egg]]
2
3== module-declarations
4
5[[toc:]]
6
7=== Description
8
9Extends CHICKEN's [[/man/4/Declarations|declaration]] mechanism with
10forms for controlling modules, imports and exports.
11
12The source for this egg is available
13[[http://git.foldling.org/chicken-module-declarations.git|here]].
14
15==== Requirements
16
17* [[/egg/matchable|matchable]]
18
19=== Usage
20
21{{module-declarations}} should be loaded as a compiler extension with
22the {{-extend}} (or {{-X}}) flag to {{csc}}:
23
24    $ csc -extend module-declarations <file>
25
26==== API
27
28When extended, {{module-declarations}} adds three declaration
29specifiers, [[#module|{{module}}]], [[#import|{{import}}]], and
30[[#export|{{export}}]]. These correspond to the [[/man/4/Modules|module
31forms]] of the same names.
32
33===== module
34
35 [declaration specifier] (module name)
36
37Wraps the current file in a [[/man/4/Modules#module|{{(module ...)}}]]
38form.
39
40Modules declared in this way implicitly import the {{scheme}} and
41{{chicken}} units before any others.
42
43If more than one {{module}} declaration is provided, the one appearing
44last takes precendence.
45
46===== import
47
48 [declaration specifier] (import library ...)
49
50Loads the given libraries into the current module using
51[[/man/4/Non-standard macros and special
52forms#require-extension|{{require-extension}}]] semantics.
53
54If no {{module}} is declared, this specifier has no effect.
55
56===== import-for-syntax
57
58 [declaration specifier] (import-for-syntax library ...)
59
60Loads the given libraries into the current module using
61[[/man/4/Non-standard macros and special
62forms#require-extension-for-syntax|{{require-extension-for-syntax}}]]
63semantics.
64
65If no {{module}} is declared, this specifier has no effect.
66
67===== export
68
69 [declaration specifier] (export identifier ...)
70
71Registers the given identifiers as exports of the current module, as
72with [[/man/4/Modules#export|export]].
73
74If no {{module}} is declared, this specifier has no effect.
75
76==== Example
77
78<enscript highlight="scheme">
79(declare (module alphabet-soup)
80         (import abc def ghi)
81         (export uvw xyz))
82
83; module content follows...
84</enscript>
85
86=== Author
87
88[[/users/evan-hanson|Evan Hanson]]
89
90=== License
91
92Copyright (c) 2014-2016, 3-Clause BSD.
Note: See TracBrowser for help on using the repository browser.