From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,571930b4ff0bc1ee X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-29 16:08:07 PST Newsgroups: comp.lang.ada Path: supernews.google.com!sn-xit-03!supernews.com!cyclone2.usenetserver.com!news-out.usenetserver.com!easynews!uunet!dfw.uu.net!ash.uu.net!world!bobduff From: Robert A Duff Subject: Re: Compile time executed functions Sender: bobduff@world.std.com (Robert A Duff) Message-ID: Date: Fri, 30 Mar 2001 00:06:05 GMT References: <3AC03CCE.70E3C2D5@mida.se> <87ae67qdrv.fsf@deneb.enyo.de> <87lmprow3a.fsf@deneb.enyo.de> <874rweoo2p.fsf@deneb.enyo.de> <3AC2EE4D.56D61A58@mida.se> <3AC2E665.F45C18A@home.com> Organization: The World Public Access UNIX, Brookline, MA X-Newsreader: Gnus v5.3/Emacs 19.34 Xref: supernews.google.com comp.lang.ada:6223 Date: 2001-03-30T00:06:05+00:00 List-Id: Mark Biggar writes: > It's been done many times. For example go read "Godel, Esher and > Bach" by Hofsteder, the section on the *LOOP languages. Obviously you > must outlaw abritrary "goto" statements, recursive procedures and > while loops, but if (case) statements and Ada like "for" loops are fine. > The trick it that you can only have looping construsts that allow > the computation of a strict bound on the number of iterations, > before the loop is entered. But if you give me a language like that, and what I really want is a while loop, I'll end up writing something like: for I in 1..10**100 loop -- or maybe just 2**31-1 ;-) exit when ...; ... end loop; It's easy to prove that the above loop is not infinite, but if I make a mistake in the exit condition, I'll end up with a very long loop, which is just as bad in practise. So I think it's better just to allow while loops, and live with the fact that they might be infinite. Unless you have a fancy proof engine that can prove termination of while loops most of the time. - Bob