Regularity
From Maze
(Difference between revisions)
(Edits to clean up hypothetical DO ... WHILE discussion.) | (→The Harmfulness of GOTO) | ||
| Line 170: | Line 170: | ||
This would certainly be a clearer way to write the program, and it would be widely recognized today as clearer because Dijkstra's view of programming has prevailed. When the creators of BASIC introduced a new version, True BASIC, in 1988, they included the "DO" loop; its syntax was a bit different from the above, but the essential construct was the same. | This would certainly be a clearer way to write the program, and it would be widely recognized today as clearer because Dijkstra's view of programming has prevailed. When the creators of BASIC introduced a new version, True BASIC, in 1988, they included the "DO" loop; its syntax was a bit different from the above, but the essential construct was the same. | ||
| − | Although this important construct is missing from BASIC, it's not obvious that the tiny program 10 PRINT would have particularly offended Dijkstra. In his letter, he objects to the "unbridled use of the '''go to''' statement" and does not state that ''every'' use of it is unambiguously bad. He describes the GOTO-related problems that arise when the values of variables getting out of a programmer's control. But 10 PRINT has no variables, so this particular problem with GOTO is not an issue. | + | Although this important construct is missing from early versions of BASIC, it's not obvious that the tiny program 10 PRINT would have particularly offended Dijkstra. In his letter, he objects to the "unbridled use of the '''go to''' statement" and does not state that ''every'' use of it is unambiguously bad. He describes the GOTO-related problems that arise when the values of variables getting out of a programmer's control. But 10 PRINT has no variables, so this particular problem with GOTO is not an issue. |
The equivalent of a GOTO statement is a staple of machine language programming; it is the unconditional branch, JMP. Dijkstra essentially exempted machine language from his critique of GOTO. He recognized that computer programs written in a high level language are more complicated and nuanced ways of expressing thought, not tied directly to machine function. By creating a new sort of language that does not directly mimic the operation of the processor, it is possible for programmers to think more flexibly and powerfully. Although Dijkstra objected to the way BASIC was designed, he, like the original designers of BASIC, worked strenuously to describe how high-level languages, useful for thinking about computation, could work in machine-independent ways. | The equivalent of a GOTO statement is a staple of machine language programming; it is the unconditional branch, JMP. Dijkstra essentially exempted machine language from his critique of GOTO. He recognized that computer programs written in a high level language are more complicated and nuanced ways of expressing thought, not tied directly to machine function. By creating a new sort of language that does not directly mimic the operation of the processor, it is possible for programmers to think more flexibly and powerfully. Although Dijkstra objected to the way BASIC was designed, he, like the original designers of BASIC, worked strenuously to describe how high-level languages, useful for thinking about computation, could work in machine-independent ways. | ||
