Newsgroups: comp.lang.misc Path: utzoo!utgpu!jarvis.csri.toronto.edu!ephemeral.ai.toronto.edu!bradb From: bradb@ai.toronto.edu (Brad Brown) Subject: Re: Turing programming language. Message-ID: <89Jan24.105318est.10803@ephemeral.ai.toronto.edu> Summary: Turing loops ain't so bad Keywords: programming language, turing Organization: Department of Computer Science, University of Toronto References: <11@euteal.UUCP> <89Jan20.111000est.4328@turing.toronto.edu> <12@euteal.UUCP> Date: Tue, 24 Jan 89 10:53:16 EST In article <12@euteal.UUCP> mart@euteal.UUCP (Mart van Stiphout) writes: > Let me explain my objections to the Turing loop syntax. > My main objection is the location of the exit criterion. It is > inside the loop and generally will be surrounded by (lots ?) of > code. >... > In my view, the stop criterion should not be located somewhere in the > middle of the loop. I can understand why you are hesitant to use the Turing syntax. However, as a former user of Turing and Turing Plus, I have to confess a real affection for the Turing loop style. I found that there were many situations where it fitted the problem better than forcing the exit condition to be tested at the beginning or end of the loop. This is especially true where you have a read-process-read-process... loop with hairy initialization. When you have to test for conditions at the beginning or end of the loop you have to unroll some initialization code, which is messy. Furthermore, you may have several distinct conditions inside the loop that could cause exit, like EOF or out of memory or bad syntax on reading. I have found that these situations usually require something like C's "break", but are handled much more naturally by the Turing "exit when". Now, I agree that there is more responsibility on the part of the programmer to maintain good style and make the exit conditions visually stand out. I got used to having whitespace around the exit when, and sometimes would have some nice bold comments to help it stand out more. Let me add that I came to Turing Plus with a strong background in Pascal and C. I am currently a professional level C programmer, and have reasonable experience in a variety of other languages. I was exposed to Turing Plus in a compilers course and an operating systems course, in both cases using it *a lot* to build reasonably large programs. I found the syntax to be, on the whole, easier and more intuitive than either Pascal or C, and REALLY LIKED the language. I don't use it any more because most of my programming either Lisp or for other people, for whom I have to use C. I just wish there was a good Turing Plus compiler for the PC!!! (-: Brad Brown :-) bradb@ai.toronto.edu