The useless web?

We continue our reading of Literate Programming, by Donald Knuth.

We completed up to section 2 of Knuth’s web program to print the first n prime numbers. Having encountered the program definition, we have in some sense read the entire thing.

We did discuss whether modern code editors render Knuth’s entire notion of the ‘web of code’ otiose. We in particular considered EMACS, a code editor that was becoming popular at the time the paper was written.

EMACS stands for “editor macros,” and it basically allows a coder to write little programs that let them interact with their source code. The particular thing I was thinking of is the way you can use EMACS or similar programs to navigate your codebase. Say you come across a function called “check_if_prime” and you don’t know how it works. In EMACS you should be able to hit a keyboard shortcut, and be taken to the part of the source code where “check_if_prime” is defined, so you can see what it does. You should then be able to hit another keyboard shortcut to go back to where you were.

If you have a good code editor, is all the elaborate cross-referencing of a WEB program required?

The Quirk

We begin our reading of Literate Programming, by Donald Knuth.

For those who had to skip this meeting, we completed up to paragraph 2 on page 98. We will recommence in a fortnight at the line “Document formatting languages are newcomers to …”.

In answer to a query: Wikipedia informs me that LaTeX is a set of macros for the underlying TeX language. A macro is a procedure that modifies the text of a file. Thus the LaTeX program allows you to write directives into your document (e.g. \documentclass), which will then be translated by the LaTeX macros into the more basic TeX code. I was wrong to say that Knuth invented LaTeX – he invented TeX. LaTeX, with its increased functionality, was invented by Leslie Lamport. I can only assume that the “La” is for “Lamport”!

The ‘illiterate’ pascal files we saw at the start of the session can be seen here.