4 ms·
Note: Best to run that program through `cweave` and read the typeset output, rather than read the `.w` file directly.
by svat 9y ago
Note: Best to run that program through `cweave` and read the typeset output, rather than read the `.w` file directly.
- taeric 9y agoIndeed, I should have mentioned this. Thanks! This is also a chapter in https://smile.amazon.com/Selected-Papers-Games-Lecture-Notes/dp/157586584X/ https://smile.amazon.com/Selected-Papers-Games-Lecture-Notes... I would be lying if I said this was super easy to read. It is easy, though. Not sure if it is a good exposition for literate programming. I certainly like it, but I think I was predisposed to.
- svat 9y agoYeah when reading some of Knuth's literate programs, I get the feeling that they are probably the best possible exposition of programs that are not so good to read. :-) That is, the programs aren't structured modularly like good modern programmers would write (encapsulation, separation of concerns, etc.) — instead they freely use global variables, gotos, etc., in the programming style of the 60s with some of Knuth's idiosyncratic improvements. But given that "bad" program, the one with the globals and the gotos, Knuth's literate programming system produces what is probably the best possible exposition of that program — at least for reading as printed material (on paper not on screen).
- taeric 9y agoI actually have grown to like globals because of this writing style. I'll note that most of what he writes is self contained in the section they are in. However, some things require you to have knowledge of how the system works. You can try and limit this from folks locally, but you wind up having confusing state passing tricks that can, amusingly, lead to bugs.