On Tue, Dec 1, 2020 at 3:14 PM Dave Horsfall <dave(a)horsfall.org> wrote:
And then there was the story of Professor Goto (a
Japanese citizen and
computer bod) who complained that everyone was trying to eliminate him :-)
But cheerfully so, according to Knuth. He is also known for the invention
of hash consing. Knuth's article "Structured programming with goto
statements" <http://www.clifford.at/cfun/cliffdev/p261-knuth.pdf> is a
great discussion of all the reasons you'd want to use goto in languages
with just conditionals and while loops: error exits, jumping out of nested
tests, jumping out of a nest of conditionals and break/continue (both
essentially kinds of static catch tags), loops iterated n-and-a-half-times
(break will do this, but it's over-powered), tail recursion, "encoding
boolean variables in the program counter", coroutines. There are also such
things as fast linear search by putting the searched-for value at the end
of the array being searched, and what boils down to Lisp macros ("allowing
an optimizing compiler to express its optimizations in the source
language").
On Tue, Dec 1, 2020 at 3:39 PM Bakul Shah <bakul(a)iitbombay.org> wrote:
But I have mixed feelings about goto vs
continue/break. A nested
loop with multiple continue/break can be as obscure.
I think if the loops are labeled rather than the destinations, and you use
"next foo" instead of "continue" and "last foo" instead of
"break", it's
all quite readable.
John Cowan
http://vrici.lojban.org/~cowan cowan(a)ccil.org
Sir, I quite agree with you, but what are we two against so many?
--George Bernard Shaw,
to a man booing at the opening of _Arms and the Man_