Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!mailrus!cornell!uw-beaver!microsoft!w-colinp From: w-colinp@microsoft.UUCP (Colin Plumb) Newsgroups: comp.lang.misc Subject: Re: Turing programming language. Message-ID: <341@microsoft.UUCP> Date: 24 Jan 89 22:00:47 GMT References: <11@euteal.UUCP> <89Jan20.111000est.4328@turing.toronto.edu> <12@euteal.UUCP> Reply-To: w-colinp@microsoft.uucp (Colin Plumb) Organization: very little Lines: 23 mart@euteal.UUCP (Mart van Stiphout) wrote: > 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. As we all know, the correctness of loops > can be shown by pre- and postconditions and the > invariant relation. Easy: the loop invariant must be true at the "exit when" line. How the loop is rotated is pretty trivial. It just turns out to be easier to show the entrance by the top of the loop and have an explicit mark for the exit. As you yourself show with the "while (c = getchar())" example, you can pull the same stunts in C, but they're messier if the condition comma-expression gets bigger. (For small cases, though, for(...;...;...) is *very* handy.) WSL, a highly C-influenced langauge has a similar construct, quif (quit if). I'd rather use C, but it is nifty. -- -Colin (uunet!microsof!w-colinp)