Structured Programming with go to Statements
different countries and different backgrounds
--the one mainly scientific, the other mainly
commercial--have communicated to me, in-
dependently of each other and on their own
initiative, their observation that the quality
of their programmers was inversely propor-
tional to the density of goto statements in
their programs .... I have done various pro-
gramming experiments.., in modified ver-
sions of ALGOL 60 in which the goto statement
was abolished .... The latter versions were
more difficult to make: we are so familiar with
the jump order that it requires some effort to
forget it! In all cases tried, however, the
program without the goto statement turned
out to be shorter and more lucid.
A few months later, at the ACM Pro-
gramming Languages and Pragmatics Con-
ference, Peter Landin put it this way [59]:
There is a game sometimes played with ALGOL
60 programs--rewriting them so as to avoid
using
go to
statements. It is part of a more
embracing game--reducing the extent to
which the program conveys its information by
explicit sequencing .... The game's signifi-
cance lies in that it frequently produces a
more "transparent" program---easier to
understand, debug, modify, and incorporate
into a larger program.
Peter Naur reinforced this opinion at the
same meeting [74, p. 179].
The next chapter in the story is what many
people regard as the first, because it made the
most waves. Dijkstra submitted a short
article to Communications of the ACM, de-
voted entirely to a discussion of go to state-
meats. In order to speed publication, the
editor decided to publish Dijkstra's article
as a letter, and to supply a new title, "Go to
statement considered harmful". This note
[23] rapidly became well-known; it expressed
Dijkstra's conviction that go to's "should
be abolished from all 'higher level' program-
ming languages (i.e., everything except,
perhaps, plain machine code) .... The go
to
statement as it stands is just too primitive;
it is too much an invitation to make a mess of
one's program." He encouraged looking for
alternative constructions which may be
necessary to satisfy all needs. Dijkstra also
recalled that Heinz Zemanek had expressed
doubts about go to statements as early as
1959; and that Peter Landin, Christopher
Strachey, C. A. R. Hoare and others had
been of some influence on his thinking.
• 265
By 1967, the entire XPL compiler had
been written by McKeeman, Homing, and
Wortman, using go to :only once ([65], pp.
365-458; the go to is on page 385). In 1971,
Christopher Strachey [87] reported that "It
is my aim to write programs with no labels.
I am doing quite well. I have got the operat-
ing system down to 5 labels and I am plan-
ning to write a compiler with no labels at
all." In 1972, an entire session of the ACM
National Conference was devoted to the
subject [44; 60; 100]. The December, 1973,
issue of Datamation featured five articles
about structured programming and elimina-
tion of go to's [3; 13; 32; 64; 67]. Thus, it is
clear that sentiments against go to state-
ments have been building up. In fact, the
discussion has apparently caused some
people to feel threatened; Dijkstra once told
me that he actually received '% torrent of
abusive letters" after publication of his
article.
The tide of opinion first hit me personally
in 1969, when I was teaching an introductory
programming course for the first time. I
remember feeling frustrated on several
occasions, at not seeing how to write pro-
grams in the new style; I would run to Bob
Floyd's office asking for help, and he usually
showed me what to do. This was the genesis
of our article [52] in which we presented two
types of programs which did not submit
gracefully to the new prohibition. We found
that there was no way to implement certain
simple constructions wit h while and condi-
tional gtatemeats substituted for go to's,
unless extra computation was specified.
During the last few years several languages
have appeared in which the designers
proudly announced that they have abolished
the go to statement. Perhaps the most
prominent of these is Brass [98], which
originally replaced go to's by eight so-called
"escape" statements. And the eight weren't
even enough; the authors wrote, "Our
mistake was in assuming that there is no
need for a label once the go to is removed,"
and they later [99, 100] added a new state-
ment "leave (label)
with
(expression)"
which goes to the place after the statement
identified by the (label). Other go to-less
languages for systems programming have
Computing Surveys, VoL 6, No. 4,
December 1974