[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
modules
A while ago, I sent a message to t-discussion suggesting that
modules of the style used in KL0 Prolog, be included in T.
Since then I tried to implement the suggestion as a macro,
but since HERALD cannot be created via a macro, the implementation
was useless.
While thinking about all of this, I came upon the following puzzle.
Consider a program organized as they are in PASCAL. In T one would
write a sequence of LET*'s and LABELS as an equivalent structure.
LABELS are needed for forward declarations and recursive type declarations.
To make a program that allows dynamic linking of this nested program
structure, it makes sense to use hierarchially arranged LOCALES.
Newer compiling languages use the idea of modules each with
a list of items exported from the module, and a list of modules
used by this module. A program is a collection of module declarations,
a module use list, an expression to be evaluated in the environment
of the modules.
(MODULES
(mod-decl mod-decl ...)
(used modules)
implicit block)
mod-decl ::= (name (used-modules) ??some expression that returns
the items exported??).
The puzzle is to write MODULES without using LOCALES, e.g.
use LAMBDA, LABELS, IF, QUOTE, ..., but not DEFINE, LOCALE,
*VALUE, or others.
If this is impossible, maybe facilities giving dynamic linking
module structure should have a parallel static structure just
as LOCALES have LABELS.
John