Documentation for the new module language from S48.
This commit is contained in:
parent
0a8e312756
commit
00319ca983
|
@ -132,6 +132,14 @@ The configuration language consists of top-level defining forms for
|
||||||
\>\altz{}~ \tt(\syn{name} \syn{type}) \\
|
\>\altz{}~ \tt(\syn{name} \syn{type}) \\
|
||||||
\>\altz{}~ \tt((\arbno{\syn{name}}) \syn{type}) \\
|
\>\altz{}~ \tt((\arbno{\syn{name}}) \syn{type}) \\
|
||||||
\syn{structure} \=\goesto{}~ \syn{name} \\
|
\syn{structure} \=\goesto{}~ \syn{name} \\
|
||||||
|
\>\altz{}~ \tt(modify \syn{structure} \arbno{\syn{modifier}}) \\
|
||||||
|
\>\altz{}~ \tt(subset \syn{structure} (\arbno{\syn{name}})) \\
|
||||||
|
\>\altz{}~ \tt(with-prefix \syn{structure} \syn{name}) \\
|
||||||
|
\syn{modifier} \=\goesto{}~ \tt(expose \arbno{\syn{name}}) \\
|
||||||
|
\>\altz{}~ \tt(hide \arbno{\syn{name}}) \\
|
||||||
|
\>\altz{}~ \tt(rename \arbno{(\syn{name}$_0$ \syn{name}$_1$)}) \\
|
||||||
|
\>\altz{}~ \tt(alias \arbno{(\syn{name}$_0$ \syn{name}$_1$)}) \\
|
||||||
|
\>\altz{}~ \tt(prefix \syn{name}) \\
|
||||||
\end{tabbing}
|
\end{tabbing}
|
||||||
\caption{The configuration language.}
|
\caption{The configuration language.}
|
||||||
\end{figure}
|
\end{figure}
|
||||||
|
@ -156,19 +164,58 @@ For building structures that export structures, there is a {\tt defpackage}
|
||||||
Many other structures, such as record and hash table facilities, are also
|
Many other structures, such as record and hash table facilities, are also
|
||||||
available in the \hack{} implementation.
|
available in the \hack{} implementation.
|
||||||
|
|
||||||
An {\tt access} clause specifies which bindings of names to structures
|
The \codemainindex{{modify}}, \codemainindex{{subset}}, and
|
||||||
will be visible inside the package body for use in {\tt structure-ref}
|
\codemainindex{{prefix}} forms produce new
|
||||||
forms. {\tt structure-\ok{}ref} has the following syntax:
|
views on existing structures by renaming or hiding exported names.
|
||||||
\begin{tabbing}
|
\code{Subset} returns a new structure that exports only the listed names
|
||||||
\qquad \syn{expression} \goesto{}~
|
from its \syn{structure} argument.
|
||||||
\tt(structure-ref \syn{struct-name} \syn{name})
|
\code{With-prefix} returns a new structure that adds \syn{prefix}
|
||||||
\end{tabbing}
|
to each of the names exported by the \syn{structure} argument.
|
||||||
The \syn{struct-name} must be the name of an {\tt access}ed structure,
|
For example, if structure \code{s} exports \code{a} and \code{b},
|
||||||
and \syn{name} must be something that the structure exports. Only
|
then
|
||||||
structures listed in an {\tt access} clause are valid in a {\tt
|
\begin{example}
|
||||||
structure-ref}. If a package accesses any structures, it should
|
(subset s (a))
|
||||||
probably open the {\tt structure-refs} structure so that the {\tt
|
\end{example}
|
||||||
structure-ref} operator itself will be available.
|
exports only \code{a} and
|
||||||
|
\begin{example}
|
||||||
|
(with-prefix s p/)
|
||||||
|
\end{example}
|
||||||
|
exports \code{a} as \code{p/a} and \code{b} as \code{p/b}.
|
||||||
|
|
||||||
|
Both \code{subset} and \code{with-prefix} are simple macros that
|
||||||
|
expand into uses of \code{modify}, a more general renaming form.
|
||||||
|
In a \code{modify} structure specification the \syn{command}s are applied to
|
||||||
|
the names exported
|
||||||
|
by \syn{structure} to produce a new set of names for the \syn{structure}'s
|
||||||
|
bindings.
|
||||||
|
\code{Expose} makes only the listed names visible.
|
||||||
|
\code{Hide} makes all but the listed names visible.
|
||||||
|
\code{Rename} makes each \syn{name}$_0$ visible as \syn{name}$_1$
|
||||||
|
name and not visible as \syn{name}$_0$ , while
|
||||||
|
\code{alias} makes each \syn{name}$_0$ visible as both \syn{name}$_0$
|
||||||
|
and \syn{name}$_1$.
|
||||||
|
\code{Prefix} adds \syn{name} to the beginning of each exported name.
|
||||||
|
The modifiers are applied from right to left. Thus
|
||||||
|
\begin{example}
|
||||||
|
(modify scheme (prefix foo/) (rename (car bus))))
|
||||||
|
\end{example}
|
||||||
|
makes \code{car} available as \code{foo/bus}..
|
||||||
|
|
||||||
|
% Use modify instead of structure-ref.
|
||||||
|
%
|
||||||
|
%An {\tt access} clause specifies which bindings of names to structures
|
||||||
|
%will be visible inside the package body for use in {\tt structure-ref}
|
||||||
|
%forms. {\tt structure-\ok{}ref} has the following syntax:
|
||||||
|
%\begin{tabbing}
|
||||||
|
%\qquad \syn{expression} \goesto{}~
|
||||||
|
% \tt(structure-ref \syn{struct-name} \syn{name})
|
||||||
|
%\end{tabbing}
|
||||||
|
%The \syn{struct-name} must be the name of an {\tt access}ed structure,
|
||||||
|
%and \syn{name} must be something that the structure exports. Only
|
||||||
|
%structures listed in an {\tt access} clause are valid in a {\tt
|
||||||
|
%structure-ref}. If a package accesses any structures, it should
|
||||||
|
%probably open the {\tt structure-refs} structure so that the {\tt
|
||||||
|
%structure-ref} operator itself will be available.
|
||||||
|
|
||||||
The package's body is specified by {\tt begin} and/or {\tt files}
|
The package's body is specified by {\tt begin} and/or {\tt files}
|
||||||
clauses. {\tt begin} and {\tt files} have the same semantics, except
|
clauses. {\tt begin} and {\tt files} have the same semantics, except
|
||||||
|
|
Loading…
Reference in New Issue