Prev: pseudocode Up: code-in-doc Top: Top

0.2.3.5. Magic things you can put in your code

Generally speaking, you enter your program code inside a `code' environment exactly as you would otherwise (the principle discussed in section See code-verissimilitude), and it will appear in your documents as shown (nicely typeset, we hope). There are two magic things that you can put in your code that do not appear in your document (directly):
Index entries:
Code is automagically indexed, but you may wish additional index entries of your own choosing.

Hidden comments:
You will sometimes want comments in your actual code that you do not want printed. An example: you might want to record next to each code block the names of the the test files used to exercise it. This is really boring information to all but the most dedicated reader.
In both cases, the information could be provided outside the code environment (i.e., without any special construct), but it could quite easily get lost (code blocks can be big, even if they shouldn't be :-).

In all cases, these annotations are in a form recognised as a comment by the compiler/whatever for that language. Please see section See Language_specific for the exact form used for the language you are interested in. A Haskell example of both magic bits might be:

[APRIL91: Yell if you really dislike (or like) these two forms of "magic things in code".]