The Great CACM GOTO Argument

The Great CACM GOTO Argument

CSc 372 — Comparative Programming Languages Spring 2017 (McCann) The Great CACM GOTO Argument In 1968, Professor Edsger W. Dijkstra wrote a letter to the editors of the Communications of the ACM, the flagship publication of the Association for Computing Machinery. He titled it “A Case against the GO TO Statement,” but the editor re-titled it “Go To Statement Considered Harmful.” It grew to become one of the most cited items in the magazine’s history. • Dijkstra, Edsger W. “Letters to the Editor: Go to Statement Considered Harmful.” Communications of the ACM, Volume 11 Issue 3, March 1968, pp. 147-8. https://doi.org/10.1145/362929.362947 In 1987, Frank Rubin submitted a letter to the editor titled “ ‘GOTO Considered Harmful’ Considered Harmful,” in which he argued that the GOTO statement is often very useful. It was published in the March issue. • Rubin, Frank. “ACM Forum: ‘GOTO Considered Harmful’ Considered Harmful,” Communications of the ACM, Volume 30, Number 3, March 1987, pp. 195-6. https://doi.org/10.1145/214748.315722 Rubin’s letter prompted a flurry of responses that were published in the May, August, and December 1987 issues. These responses included a response from Rubin to the flurry, a response from Dijkstra to the flurry, and a reponse from Rubin to Dijkstra’s response. We can only imagine the volume and tone of the responses and rejoinders had this occurred today on social media. • Ashenhurst, Robert L., Ed. “ACM Forum,” Communications of the ACM, Volume 30, Number 5, May 1987, pp. 350–5. https://doi.org/10.1145/22899.315729 • Ashenhurst, Robert L., Ed. “ACM Forum,” Communications of the ACM, Volume 30, Number 8, August 1987, pp. 658–62. https://doi.org/10.1145/27651.315742 • Ashenhurst, Robert L., Ed. “ACM Forum,” Communications of the ACM, Volume 30, Number 12, December 1987, pp. 996–9. https://doi.org/10.1145/33447.315758 The following pages are from scans of the original pages in the CACM. I expect you’ll find these letters to be interesting reading, particularly from your points of view as programmers who were taught programming long after the GOTO statement ceased to be an option in most new languages. “At the IFIP Congress in 1971 I had the pleasure of meeting Dr. Eiichi Goto of Japan, who cheerfully complained that he was always being eliminated.” — Donald Knuth, in “Structured Programming with go to Statements,” Computing Surveys, Vol. 6, No. 4, December 1974. Go To Statement Considered Harmful dynamic progress is only characterized when we also give to which call of the procedure we refer. With the inclusion of procedures Key Words and Phrases: go to statement, jump instruction, we can characterize the progress of the process via a sequence of branch instruction, conditional clause, alternative clause, repet- textual indices, the length of this sequence being equal to the itive clause, program intelligibility, program sequencing dynamic depth of procedure calling. CR Categories: 4.22, 5.23, 5.24 Let us now consider repetition clauses (like,while B repeat A EDITOR : or repeat A until B). Logically speaking, such clauses are now For a number of years I have been familiar with the observation superfluous, because we can express repetition with the aid of that the quality of programmers is a decreasing function of the recursive procedures. For reasons of realism I don't wish to ex- density of go to statements in the programs they produce. More clude them: on the one hand, repetition clauses can be imple- recently I discovered why the use of the go to statement has such mented quite comfortably with present day finite equipment; on disastrous effects, and I became convinced that the go to state- the other hand, the reasoning pattern known as "induction" ment should be abolished from all "higher level" programming makes us well equipped to retain our intellectual grasp on the languages (i.e. everything except, perhaps, plain machine Code). processes generated by repetition clauses. With the inclusion of At'that time I did not attach too much importance to this dis- the repetition clauses textual indices are no longer sufficient to covery; I now submit my considerations for publication because describe the dynamic progress of the process. With each entry into in very recent discussions in which the subject turned up, I have a repetition clause, however , we can associate a so-called "dy- been urged to do so. namic index," inexorably counting the ordinal number of the My first remark is that, although the programmer's activity corresponding current repetition. As repetition clauses (just as ends when he has constructed a correct program, the process procedure calls) may be applied nestedly, we find that now the taking place under control of his program is the true subject progress of the process Can always be uniquely characterized by a matter of his activity, for it is this process that has to accomplish (mixed) sequence of textual and/or dynamic indices. the desired effect; it is this process that in its dynamic behavior The main point is that the values of these indices are outside has to satisfy the desired specifications. Yet, once the program has programmer's control; they are generated (either by the write-up been made, the "making" of the corresponding process is dele- of his program or by the dynamic evolution of the process) whether gated to the machine. he wishes or not. They provide independent coordinates in which My second remark is that our intellectual powers are rather to describe the progress of the process. geared to master static relations and that our powers to visualize Why do we need such independent coordinates? The reason processes evolving in time are relatively poorly developed. For is--and this seems to be inherent to sequentiM processes--that that reason we should do (as wise programmers aware of our we can interpret the value of a variable only with respect to the limitations) our utmost to shorten the conceptual gap between progress of the process. If we wish to count the number, n say, of the static program and the dynamic process, to make the cor- people in an initially empty room, we can achieve this by increas- respondence between the program (spread out in text space) and ing n by one whenever we see Someone entering the room. In the the process (spread out in time) as trivial as possible. in-between moment that we have observed someone entering the Let us now consider how we can characterize the progress of a room but have not yet performed the subsequent increase of n, process. (You may think about this question in a very concrete its value equals the number of people in the room minus one! manner: suppose that a process, considered as a time succession The unbridled use of the go to statement has an immediate of actions, is stopped after an arbitrary action, what data do we consequence that it becomes terribly hard to find a meaningful set have to fix in order that we can redo the process until the very of coordinates in which to describe the process progress. Usually, same point?) If the program text is a pure concatenation of, say, people take into account as well the values of some well chosen assignment statements (for the purpose of this discussion regarded variables, but this is out of the question because it is relative to as the descriptions of single actions) it is sufficient to point in the the progress that the meaning of these values is to be understood l program text to a point between two successive action descrip- With the go to statement one can, of course, still describe the tions. (In the absence of go to statements I can permit myself the progress uniquely by a counter counting the number of actions syntactic ambiguity in the last three words of the previous sen- performed since program start (viz. a kind of normalized clock). tence: if we parse them as "successive (action descriptions)" we The difficulty is that such a coordinate, although unique, is utterly mean successive in text space; if we parse as "(successive action) unhelpful. In such a coordinate system it becomes an extremely descriptions" we mean successive in time.) Let us call such a complicated affair to define all those points of progress where, pointer to a suitable place in the text a "textual index." say, n equals the number of persons in the room minus onet When we include conditional clauses (if B then A), alternative The go to statement as it stands is just too primitive; it is too clauses (if B then AZ else A2), choice clauses as introduced by much an invitation to make a mess of one's program. One can C. A. R. Hoare (case[i]of(At, A2, ... ,An)), or conditional expres- regard and appreciate the clauses considered as bridling its use. I sions as introduced by J. McCarthy (Bi -~ El, B2 --~ E2, ... , do not claim that the clauses mentioned are exhaustive in the sense Bn ---~En), the fact remains that the progress of the process re- that/hey will satisfy all needs, but whatever clauses are suggested mains characterized by a single textual index. (e.g. abortion clauses) they should satisfy the requirement that a As soon as we include in our language procedures we must admit programmer independent coordinate system can be maintained to that a single textual index is no longer sufficient. In the case that describe the process in a helpful and manageable way. a textual index points to the interior of a procedure body the It is hard to end this with a fair acknowledgment.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    19 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us