[net.lang] contradictory goto stories

mckeeman@wivax.UUCP (05/31/84)

I never expected to see the goto controversy spring back
up, but I have two quite opposite experiences which I have
found illuminating; perhaps some of you will enjoy them.  I
speak from the podium of a publicly acknowledged go-to-killer.

The XPL compiler, 4000 lines in a subset of PL/I, was
written (in 1966) with about 30 gotos.  In a fit of good
style we took out all but one (as mentioned by Knuth in the
article that started all this).  It took days to get them
out which indicates to me that the restructuring that was
going on was substantial.  (Interested readers can see the
listing in "A Compiler Generator", McKeeman, Horning &
Wortman).  The program was definitely the better for it.

Contrary example: I wrote a Fortran subset parser in Pascal
in 1981 (about 24K characters).  Version 1 had no goto-s.
I then rewrote it with 43 goto-s (I just finished counting
them a moment ago) and it is a much better program.  The
reason is that Fortran can be parsed pretty elegantly by
backtracking, which needs lots of "emergency" procedure and
loop exits on "fail".  43 to be exact.

For me the moral is that conceptual elegance is the desired
quality; there is no simple rule (like NOGOTO) to get it.
When we are teaching, we do our best, but should always try
to keep the student aware that our simple, even foolish,
strictures are aimed much higher than anything expressible
in a grody programming language (aren't they all).

/s/ Bill   McKeeman.Wang-Inst at CSNet-Relay
           ...decvax!wivax!mckeeman
           Wang Institute of Graduate Studies, Tyngsboro, MA 01879