2 ms·
Knuth is obviously doing it wrong because his idea of "literate" programming involves chopping up the source code of a program at arbitrary line numbers, and as
by kazinator 5y ago
Knuth is obviously doing it wrong because his idea of "literate" programming involves chopping up the source code of a program at arbitrary line numbers, and assigning them macro identifiers.
What this lets him do is talk, in detail, about those fragments of a program in the academic paper that the program is about, with the commentary interspersed among those fragments.
Then the paper can present how those fragments are combined together to form the next unit, and so on.
It's a complete non-starter for production code; anything written by two or more programmers whose goal isn't to have a working system documented in detail by an academic paper from whose markup source code it pops out as a side effect.
- svat 5y agoThis comment would make sense if Knuth used literate programming primarily for academic papers. But in fact he created WEB for writing TeX and METAFONT, both of which (while their source code was published as a book later) were production systems, and in fact for several decades now he uses CWEB for all programs he writes, including several a week that he writes for himself. (Some of which are online at https://cs.stanford.edu/~knuth/programs.html https://cs.stanford.edu/~knuth/programs.html .) In contrast, apart from the paper he wrote introducing LP, and the two Bentley columns about LP in CACM, I'm not aware of any other academic paper of his that presents programs — at any rate, the total number must be very small. The goal is not an "academic paper"; his experience (and that of others who have seriously tried LP) is that it helps with actual writing of programs, less time spent debugging, etc. Yes, there are challenges with two or more programmers, but nothing unsurmountable. See "Literate Programming on a Team Project" (https://www.cs.princeton.edu/techreports/1991/302.pdf https://www.cs.princeton.edu/techreports/1991/302.pdf coauthored by Norman Ramsey, who later developed noweb) and some stories like https://news.ycombinator.com/item?id=17484452 https://news.ycombinator.com/item?id=17484452 (and https://github.com/thi-ng/geom https://github.com/thi-ng/geom which went from LP to conventional).