3 ms·
My take on this is that TANGLE-style reordering is much less necessary now that we have ubiquitous forward referencing and variables that can be declared in the
by wolfgang42 3y ago
My take on this is that TANGLE-style reordering is much less necessary now that we have ubiquitous forward referencing and variables that can be declared in the middle of a function. If you read Knuth’s Pearls example[1], a lot of the code blocks would be separate constants or functions; but he’s using WEB to inline them to compensate for the one-pass compiler and associated limitations. In a modern language for the most part you already have the freedom to order your code blocks however you want, and you don’t need a separate tool to make this possible. At that point the main advantage that the technique offers is particularly extensive and well-formatted comments.
McIlroy also touches on this in his review, though from the other direction:
> Perhaps the greatest strength of WEB is that it allows almost any sensible order of presentation. Even if you did not intend to include any documentation, and even if you had an ordinary cross-referencer at your disposal, it would make sense to program in WEB simply to circumvent the unnatural order forced by the syntax of Pascal.
[1] Of “Knuth v McIlroy” fame: https://homepages.cwi.nl/~storm/teaching/reader/BentleyEtAl86.pdf https://homepages.cwi.nl/~storm/teaching/reader/BentleyEtAl8...
- remexre 3y agoForth dialects typically don't have forward referencing _or_ variables that can be defined in the middle of a function, though! (Though, writing a function long enough that you might want to declare a variable part-way through it would probably be a code smell in Forth...)
- wolfgang42 3y agoI was vaguely under the impression that Forth only dereferenced words from the dictionary into functions when you call them, but I admit I haven’t actually used it. In that case, being able to reorder your code so you can give the overview of what you’re trying to do before diving into the finer details of its internals does seem like a great help!