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 11:55:38 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3DC8222D.3080601@acm.org> From: Jeffrey Carter User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Local vs global variables in ADA References: <5Ldx9.3695$151.38236@weber.videotron.net> <3DC5D1B7.1060707@acm.org> <3DC6DD54.10200@acm.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 05 Nov 2002 19:54:44 GMT NNTP-Posting-Host: 63.184.16.49 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1036526084 63.184.16.49 (Tue, 05 Nov 2002 11:54:44 PST) NNTP-Posting-Date: Tue, 05 Nov 2002 11:54:44 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:30397 Date: 2002-11-05T19:54:44+00:00 List-Id: Fraser Wilson wrote: > > On the "while" comment: are you (or were they) referring to the fact > that a while loop can be expressed as a loop/exit when/end loop > construction, or is there something about while loops that should be > avoided? Isn't there a preference hierarchy from for loop to while > loop to loop? I.e. use a for loop whenever possible, failing that a > while loop, and as a last resort a loop with an exit. OK, and as a > last last resort use a goto. The point made by Ichbiah, Barnes, and Firth at the Ada Launch was that while loops express the condition for continuation, not exit, and this is difficult for beginners to understand, and they usually require the use of negative logic (while not End_Of_File), which is often more difficult to understand than positive logic; that a loop with an exit as its first statement expresses the condition for exit, and this is easy for everyone to understand, and it usually uses positive logic (exit when End_Of_File). For these reasons they thought the latter form should be prefered. There are as many preference hierarchies as there are people creating preference hierarchies. Here's one: use assembler whenever possible, failing that use C, failing that use a C derivative, failing that use another language other than Ada, and use Ada when forced to at gunpoint. I don't happen to agree with it, but I suspect that there are those who do. Just because you've seen someone's preference hierarchy doesn't mean you should follow it. I use the rule that you should use the appropriate form of a loop for the iteration that's required. If you accept the arguments of "the founders", while is never the appropriate form. -- Jeff Carter "We burst our pimples at you." Monty Python & the Holy Grail