Prev: separate-compilation
Up: Glasgow-objectives
Top: Top
0.1.1.8. Using one file in several ways
Say you're writing a Haskell compiler :-), which includes the
source code for a typechecker. On the one hand, you want this to be
included in "the book" (document) that is the whole compiler.
However, you may also want to have a "typechecker document" that is
itself self-contained (if only because the "book" is so big). Going
further: perhaps one module of your typechecker is so amazing that you
want to publish it as a paper.
You could make copies of files, edit them, etc., but that's tacky, and
against a most deeply-held principle of literate programming: that you are
looking at the source code for the program being described.
As it stands, this system lets you put `\begin{onlystandalone}' and
`\end{onlystandalone}' around pieces of your files that only apply
in the "do this as a standalone document" case; similarly,
`\begin{onlypartofdoc}' and `\end{onlypartofdoc}' for stuff that
only applies in the "the glorious whole" case.
APRIL91: I am fairly convinced I got this wrong and believe that
this stuff would be much better handled with a pseudo-"C
pre-preprocessor" (one that does not look inside code blocks [see
deeply-held principle above; section See code-verissimilitude]); see
section See pseudo-C-preprocessor.