And August in which Dijkstra weighs in, complaining “The whole correspondence was carried out at a level that vividly reminded me of the intellectual climate of 20 years ago, as if stagnation were the major characteristic of the computing profession, and that was a disappointment.”
I think the first two defenses are great examples of the core problem with goto: it’s too unrestricted in what it can do. Continuations and break are significantly more restricted than the original goto, so they’re not harmful!
The go to statement as it stands [emphasis mine –dpk] is just too primitive; it is too much an invitation to make a mess of one’s program. One can regard and appreciate the clauses considered as bridling its use. [Here Dijkstra seems to be talking about using ‘go to’ with some discipline to apply it only in particular situations; but it’s also possible to interpret as referring to alternative control flow constructs beyond the theoretical straitjacket of what the Structured Program Theorem allows, such as ‘break’. –dpk] I do not claim that the clauses mentioned are exhaustive in the sense that they will satisfy all needs, but whatever clauses are suggested (e.g. abortion clauses [‘break’ in modern terms –dpk]) they should satisfy the requirement that a programmer independent coordinate system can be maintained to describe the process in a helpful and manageable way.
Yes, stack frames were not yet standard at the time of Dijkstra’s letter in 1968, but they were standard in new systems and languages after about that time – tho Knuth was still concerned they might not be supported in 1974. By the time of the 1987 flamewar that worry was pretty much gone.
This is one of the peculiarities of Dijkstra. On one hand, he was a skilled and precise writer whose prose was a pleasure to read. On the other hand, he loved to attach trolls like ‘GOTO considered harmful’ to his otherwise carefully considered texts. It certainly garnered them more attention, but I doubt they garnered them any more careful readings. If ‘GOTO considered harmful’ had been titled ‘Benefits of restricting control flow constructs’, it would be no more controversial than his book ‘Predicate Calculus and Program Semantics.’
CACM March 1987 in the ACM digital library without the wayback machine’s busted PDF wrapper.
And in May, ‘ “GOTO considered harmful” considered harmful’ considered harmful
And June
And July
And August in which Dijkstra weighs in, complaining “The whole correspondence was carried out at a level that vividly reminded me of the intellectual climate of 20 years ago, as if stagnation were the major characteristic of the computing profession, and that was a disappointment.”
And November plus If you can take it, more on GOTOs
And December
In March 1988 the correspondence gets into meta issues good grief
Dijkstra (1968)
Knuth (1974)
To kickstart some conversation, here are some further ideas in defense of gotos:
goto recover_from_errorThough of course we love structured programming, fitting our code structure to our data (and not wallowing in the mire of implementation details).
I think the first two defenses are great examples of the core problem with goto: it’s too unrestricted in what it can do. Continuations and
breakare significantly more restricted than the original goto, so they’re not harmful!This was, in fact, Dijkstra’s actual point:
re unstructured programming: this was even a time before the stack frame was a standard concept that everyone assumes will always be present.
Even Minecraft Redstone computers are including dedicated stack hardware because it’s just assumed that you need a stack
Yes, stack frames were not yet standard at the time of Dijkstra’s letter in 1968, but they were standard in new systems and languages after about that time – tho Knuth was still concerned they might not be supported in 1974. By the time of the 1987 flamewar that worry was pretty much gone.
This is one of the peculiarities of Dijkstra. On one hand, he was a skilled and precise writer whose prose was a pleasure to read. On the other hand, he loved to attach trolls like ‘GOTO considered harmful’ to his otherwise carefully considered texts. It certainly garnered them more attention, but I doubt they garnered them any more careful readings. If ‘GOTO considered harmful’ had been titled ‘Benefits of restricting control flow constructs’, it would be no more controversial than his book ‘Predicate Calculus and Program Semantics.’
I think the editor chose the title.
I didn’t know that, thanks. It would have been in character for Dijkstra, too.
I wrote BASIC with GOTO. Hellishly bad. I write C with goto. It’s fine
I remember learning GWBasic in the end of the 80s in to the 90s. I was young enough and couldn’t conceive of programming without gotos.