comp.lang.ada
 help / color / mirror / Atom feed
From: nobody@REPLAY.COM (Anonymous)
Subject: Re: Building blocks (Was: Design By Contract)
Date: 1997/10/01
Date: 1997-10-01T00:00:00+00:00	[thread overview]
Message-ID: <199710011402.QAA02444@basement.replay.com> (raw)
In-Reply-To: 34316EC3.5B62@dynamite.com.au


<342A0AC6.2F2F@dynamite.com.au>
<199709251320.PAA03585@basement.replay.com>

On Tue, 30 Sep 1997 14:27:31 -0700, Alan E & Carmel J Brain
<aebrain@dynamite.com.au> 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? (<g> 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/




  parent reply	other threads:[~1997-10-01  0:00 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-09  0:00 Building blocks (Was: Design By Contract) Marc Wachowitz
1997-09-15  0:00 ` Joachim Durchholz
1997-09-17  0:00 ` Paul Johnson
1997-09-18  0:00   ` Jon S Anthony
1997-09-18  0:00   ` Stephen Leake
1997-09-18  0:00     ` Mark L. Fussell
1997-09-19  0:00       ` Jon S Anthony
1997-09-23  0:00         ` Mark L. Fussell
1997-09-19  0:00       ` Robert A Duff
1997-09-20  0:00         ` Joachim Durchholz
1997-09-22  0:00           ` Matthew Heaney
1997-09-23  0:00             ` Joachim Durchholz
1997-09-23  0:00             ` Veli-Pekka Nousiainen
1997-10-03  0:00               ` Robert I. Eachus
1997-10-04  0:00                 ` Paul Johnson
1997-10-14  0:00                   ` Robert I. Eachus
1997-09-23  0:00           ` Jon S Anthony
1997-09-24  0:00           ` Alan E & Carmel J Brain
1997-09-25  0:00             ` Anonymous
1997-09-30  0:00               ` Alan E & Carmel J Brain
1997-09-30  0:00                 ` Matthew Heaney
1997-09-30  0:00                   ` W. Wesley Groleau x4923
1997-09-30  0:00                     ` Matthew Heaney
1997-10-01  0:00                     ` Alan E & Carmel J Brain
1997-09-30  0:00                   ` Neil Wilson
1997-09-30  0:00                     ` Stephen Leake
1997-10-01  0:00                 ` Anonymous [this message]
1997-10-01  0:00                   ` Paul M Gover
1997-10-04  0:00                     ` Paul Johnson
1997-10-04  0:00                       ` Matthew Heaney
1997-10-15  0:00                         ` Paul Johnson
1997-10-15  0:00                           ` Matthew Heaney
1997-10-16  0:00                             ` Joachim Durchholz
1997-10-17  0:00                               ` Robert I. Eachus
1997-10-16  0:00                           ` Joachim Durchholz
1997-10-22  0:00                           ` Reimer Behrends
1997-10-01  0:00                   ` Joachim Durchholz
1997-10-02  0:00                   ` Robert A Duff
1997-10-02  0:00                     ` Tucker Taft
1997-10-02  0:00                       ` Matthew Heaney
1997-10-03  0:00                     ` Stephen Leake
1997-10-04  0:00                     ` Matthew Heaney
1997-10-07  0:00                       ` Robert A Duff
1997-09-24  0:00           ` Richard A. O'Keefe
     [not found]       ` <11861963wnr@eiffel.demon.co.uk>
1997-09-19  0:00         ` Mark L. Fussell
1997-09-18  0:00     ` W. Wesley Groleau x4923
1997-09-21  0:00       ` Matthew Heaney
1997-09-18  0:00   ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1997-09-11  0:00 Robert Dewar
1997-09-09  0:00 Marc Wachowitz
1997-09-02  0:00 Design By Contract Jon S Anthony
     [not found] ` <JSA.97Sep3201329@alexandria.organon.com>
1997-09-04  0:00   ` Paul Johnson
     [not found]     ` <5un58u$9ih$1@gonzo.sun3.iaf.nl>
1997-09-06  0:00       ` Building blocks (Was: Design By Contract) Joachim Durchholz
1997-09-08  0:00       ` Paul Johnson
1997-09-08  0:00         ` Brian Rogoff
1997-09-09  0:00           ` Veli-Pekka Nousiainen
1997-09-09  0:00             ` Jon S Anthony
1997-09-09  0:00           ` Veli-Pekka Nousiainen
1997-09-09  0:00           ` Matthew Heaney
1997-09-09  0:00             ` W. Wesley Groleau x4923
1997-09-10  0:00               ` Robert A Duff
1997-09-12  0:00                 ` Jon S Anthony
1997-09-09  0:00             ` Brian Rogoff
1997-09-10  0:00             ` Paul Johnson
1997-09-10  0:00               ` Darren New
1997-09-10  0:00               ` Matthew Heaney
1997-09-10  0:00             ` Robert Dewar
1997-09-12  0:00               ` Paul Johnson
1997-09-14  0:00                 ` Robert Dewar
1997-09-14  0:00                 ` Robert Dewar
1997-09-14  0:00                 ` Robert Dewar
1997-09-15  0:00                   ` John G. Volan
1997-09-12  0:00               ` Jon S Anthony
1997-09-12  0:00                 ` Robert Dewar
1997-09-16  0:00                   ` Brian Rogoff
1997-09-09  0:00           ` W. Wesley Groleau x4923
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox