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.3 required=5.0 tests=BAYES_00,INVALID_MSGID 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 X-Google-Thread: fac41,f66d11aeda114c52 X-Google-Attributes: gidfac41,public From: nobody@REPLAY.COM (Anonymous) Subject: Re: Building blocks (Was: Design By Contract) Date: 1997/10/01 Message-ID: <199710011402.QAA02444@basement.replay.com>#1/1 X-Deja-AN: 277045961 References: <34316EC3.5B62@dynamite.com.au> X-001: Replay may or may not approve of the content of this posting X-002: Report misuse of this automated service to X-URL: http://www.replay.com/remailer/ Organization: Replay and Company UnLimited Mail-To-News-Contact: postmaster@nym.alias.net Newsgroups: comp.lang.ada,comp.lang.eiffel Date: 1997-10-01T00:00:00+00:00 List-Id: <342A0AC6.2F2F@dynamite.com.au> <199709251320.PAA03585@basement.replay.com> On Tue, 30 Sep 1997 14:27:31 -0700, Alan E & Carmel J Brain wrote: > Anonymous wrote: > [big hunk deleted] > > 2. Using while instead of loop/exit (ref. Ichbiah, Barnes, & Firth, "Ada > > Launch," 1980 Dec 10, videotape, on why while was included in the > > language). > > I'd defend this one on style grounds, and believe the matter is > religious. I have no access to this video. Any other sources? BTW > perfectly willing to believe I'm wrong, I just want to know why... This is an obscure reference, and I'd be the first to admit I've never seen this addressed anywhere else, including Barnes' book. In the video, which I had the good fortune to see in 1984, these three members of the design team give a tutorial on Ada-80 (MIL-STD-1815) with plenty of comments on "why". "While" was said to be undesireable because it tends to require the use of negative logic, which is less readable than positive logic: Read : while not End_Of_File (Fred) loop Read : loop exit Read when End_Of_File (Fred); It was included in the language for the same reason as "goto": to facilitate automated translation from languages that include the feature. Certainly "while" is preferred by those doing program correctness proofs; all the techniques for this that I have seen have been for "while" loops. Avoiding "while" does usually make for more readable code. In this specific example, "while" requires a flag variable, which is less readable than using "exit". [hunk deleted] > > 4. Unusual formatting of the if. > > Style again. If expressible more clearly on one or two lines, use that, Certainly, this is a style question. But the style used is not typical. > Makes sense to me. OTOH there is a school of thought that eschews > multiple exits. But that's another story. The point is, is that both > versions show in a minimum number of lines the various options one has > in Ada ( -83 at least, there are more in -95), which was the basic idea. I'm aware of those who think multiple exits are bad. This is something that came out of program correctness proving. However, when you look at languages that only allow a single exit from a loop (Pascal, excluding gotos) you find many common situations in which this results in unreadable code. For this reason, "exit" and the possiblity of multiple exits were included in Ada, and are considered acceptable by all competent software engineers. > > > "You brightly-colored, mealy-templed, cranberry-smelling, electric > > donkey-bottom biters." > > Was this meant personally? ( added for the hard-of-thinking) If so, I > take exception! (That's supposed to be a pun.... never mind...) > -- Of course this was meant personally. However, it doesn't come from me, it comes from Monty Python, so you should take exception with them. Jeff Carter PGP:1024/440FBE21 My real e-mail address: ( carter @ innocon . com ) "I fart in your general direction." Monty Python & the Holy Grail Posted with Spam Hater - see http://www.compulink.co.uk/~net-services/spam/