[bitc-dev] BitC Modules
Jonathan S. Shapiro
shap at eros-os.org
Sat Feb 12 09:53:30 EST 2005
We are going to introduce modules into BitC. This is a provisional
description in case we missed something.
1. Every compilation unit is a module. The revised definition of a
compilation unit is:
(module ident ;; purely for convenience of identification
The BitC compiler will impose the restriction that all values bound at
top level in a module are deep frozen unless BOTH of the following are
A) The module contains a declaration that it is stateful:
(declare (module-properties stateful))
B) A command line option --stateful is supplied to the compiler
enabling stateful module compilation.
2. No symbol is implicitly exported from a module. Every exported symbol
must be declared by
(export ident ... ident)
3. Modules are imported by the IMPORT or STATEFUL-IMPORT forms:
(import local-name module-name)
(stateful-import local-name module-name)
where the details of "module-name" still need to be worked out, but the
most likely answer is some identifier that can be mapped to a file
containing a unit of compilation.
Note that a module's state is imported into a program image exactly
once. It is necessary to specify this exactly because modules may be
The effect of STATEFUL-IMPORT is to cause the identifier LOCAL-NAME to
name an environment containing all of the symbols exported by the module
named by MODULE-NAME.
The effect of IMPORT is to cause the identifier LOCAL-NAME to name an
environment containing all of the deep frozen symbols exported by the
module named by MODULE-NAME.
That is, if module X exports a deep frozen symbol a:int, the effect of
(import localNameForX X)
is that the symbol
is now an alias for the symbol 'a' in module X.
More information about the bitc-dev