3 ms·
Well, there's more than one way to write literature, and there's more than one way to approach literate programs. So while I agree that you can do most of what
by mhd 14y ago
Well, there's more than one way to write literature, and there's more than one way to approach literate programs. So while I agree that you can do most of what you want with a more simplified approach, I don't think that Knuth's approach was just there to escape from Pascal's declaration syntax.
Out-of-order code can be quite useful if the literate document is the narrative of the code, how you derive your algorithms and create your functions. The final untangled code is devoid of this, and presents a more conventional structure. One example would be some global variables (or configuration hash, if that statement made you faint a bit). In the end, you probably would want at least one view of the code where this is collected in one spot, even if the programming language would theoretically allow you to declare it bit by bit all over the place.
On the other hand, this style doesn't lend itself that well to a constantly revised code base, as that would mean reading a narrative all over again.