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,8002154d2966e1a1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-05 14:38:16 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!news.tufts.edu!uunet!dca.uu.net!ash.uu.net!world!news From: Robert A Duff Subject: Re: Local vs global variables in ADA User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Tue, 5 Nov 2002 22:37:51 GMT Content-Type: text/plain; charset=us-ascii References: <5Ldx9.3695$151.38236@weber.videotron.net> <3DC5D1B7.1060707@acm.org> <3DC6DD54.10200@acm.org> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Organization: The World Public Access UNIX, Brookline, MA Xref: archiver1.google.com comp.lang.ada:30408 Date: 2002-11-05T22:37:51+00:00 List-Id: Stephen Leake writes: > Never use a "while" loop. Mostly because "exit when" is much clearer, > partly because I've used other languages that had slightly different > definitions of "while", and I can't keep them straight. Like what? I mean, which languages have different definitions of "while" loops, and what are the differences. I thought "while" loops were one of the few cases where there is pretty much agreement on the semantics across languages. I like while loops, and use them in favor of loop/exit whenever the exit condition happens at the top. I seem to recall some issue in SPARK, where they discouraged while loops. Something about wanting to put a loop-invariant before the exit condition? Maybe one of the SPARK folks can comment on that. I'm happy to write assertions that help program-proving tools, if they also help me, the human reader (or at least neutral to the human reader), but I'm a bit uncomfortable using a style that helps tools, but hinders humans. - Bob