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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f66d11aeda114c52 X-Google-Attributes: gid103376,public From: Alan E & Carmel J Brain Subject: Re: Building blocks (Was: Design By Contract) Date: 1997/10/01 Message-ID: <3432CA07.3B5D@dynamite.com.au>#1/1 X-Deja-AN: 276923128 References: <342A0AC6.2F2F@dynamite.com.au> <199709251320.PAA03585@basement.replay.com> <34316EC3.5B62@dynamite.com.au> <343149D9.6A30@pseserv3.fw.hac.com> Reply-To: aebrain@dynamite.com.au Organization: @home Newsgroups: comp.lang.ada Date: 1997-10-01T00:00:00+00:00 List-Id: W. Wesley Groleau x4923 wrote: > > > Yes, it's quite wrong to use a flag to terminate a while loop, > > instead of just using exit with a loop. The idiom is, use an > > exit when the termination depends on what you read, ..... > > Or to end a search when the item is found, or ... > > Unfortunately, there are those who feel that not identifying the > loop termination at the beginning of the loop confuses the reader. > These folk are supported by a non-thoughtful reading of Ada Quality > and Style. The "guidelines" (we all know that's another word for > "rules," right?) say to only exit from a plain loop, never from > a 'while' or 'for' So folks go through wierd contortions to avoid > "exit." But the accompanying explanation clearly says that > _readability_ is the criteria for choosing a loop construct. Concur. The "bottom line" is readability, that's a given (I hope..). In this case, W. Wesley Groleau has provided pursuasive evidence that my "while Unfinished" construct is less readable than his "exit" construct. Although I'm not completely convinced, I am pursuaded that the "exit" construct is superior, at least in this case. And I thought I was a true disciple of "egoless" review. There's nothing like having a bunch of people expose one's coding failings in public, calmly and correctly, to show how far one has to go. Still, I've learnt something important I didn't know before, and that's worth any amount of ego damage. My thanks to all concerned. -- aebrain@dynamite.com.au <> <> How doth the little Crocodile | Alan & Carmel Brain| xxxxx Improve his shining tail? | Canberra Australia | xxxxxHxHxxxxxx _MMMMMMMMM_MMMMMMMMM abrain@cs.adfa.oz.au o OO*O^^^^O*OO o oo oo oo oo By pulling MAERKLIN Wagons, in 1/220 Scale