From: "John G. Volan" <johnvolan@sprintmail.com>
Subject: Re: GOTO considered necessary (reworked)
Date: 1997/06/12
Date: 1997-06-12T00:00:00+00:00 [thread overview]
Message-ID: <33A052FD.6519@sprintmail.com> (raw)
In-Reply-To: 199706121410.QAA05823@basement.replay.com
Anonymous (Jeff Carter) wrote:
>
> On 11 Jun 1997 15:40:22 -0500, smize@news.imagin.net (Samuel Mize)
> wrote:
>
> > b) "Continue" loop logic
> >
> > The "continue" function of C has to be emulated in Ada with a "goto":
> >
> > loop
> > ...
> > goto <<CONTINUE>>
> > ...
> > <<CONTINUE>>
> > end loop;
> >
> > This is a special case of the process continuation structure.
>
> Of course, the code in this example is the same as
>
> loop
> ... -- This is the first "..." in the example
> end loop;
>
> since the second "..." is never executed. Real use of continue involves
> a conditional:
>
> loop
> ... -- 1
>
> if Condition then
> continue;
> end if;
>
> ... -- 2
> end loop;
>
> (assuming "continue" were part of Ada :). This is equivalent to
>
> loop
> ... -- 1
>
> if not Condition then
> ... -- 2
> end if;
> end loop;
>
> This is just as readable, and less error-prone on modification than
> using a goto.
But what if you had this:
loop
... --1
if <condition expression 1> then
continue;
end if;
... --2
if <condition expression 2> then
continue;
end if;
... -- 3
if <condition expression 3> then
continue;
end if;
... -- 4
end loop;
Without goto or continue, this would have to be restructured as:
loop
... --1
if not <condition expression 1> then
... --2
if not <condition expression 2> then
... -- 3
if not <condition expression 3> then
... -- 4
end if;
end if;
end if;
end loop;
Whichever side you fall on in this debate, you have to at least agree
that a "continue" within a loop is just another example of the "process
continuation logic" situation Sam Mize described.
------------------------------------------------------------------------
Internet.Usenet.Put_Signature
(Name => "John G. Volan",
Employer => "Texas Instruments Advanced C3I Systems, San Jose, CA",
Work_Email => "johnv@ti.com",
Home_Email => "johnvolan@sprintmail.com",
Slogan => "Ada95: World's *FIRST* International-Standard OOPL",
Disclaimer => "My employer never defined these opinions, so using " &
"them would be totally erroneous...or is that just " &
"nondeterministic behavior now? :-) ");
------------------------------------------------------------------------
next prev parent reply other threads:[~1997-06-12 0:00 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-06-11 0:00 GOTO considered necessary (reworked) Samuel Mize
1997-06-11 0:00 ` Bryce Bardin
1997-06-12 0:00 ` Michael F Brenner
1997-06-17 0:00 ` Robert Dewar
1997-06-17 0:00 ` Robert A Duff
1997-06-20 0:00 ` Robert Dewar
1997-06-21 0:00 ` Robert A Duff
1997-06-21 0:00 ` Robert Dewar
1997-06-12 0:00 ` Anonymous
1997-06-12 0:00 ` John G. Volan [this message]
1997-06-16 0:00 ` Anonymous
1997-06-12 0:00 ` Robert Dewar
1997-06-12 0:00 ` John G. Volan
1997-06-13 0:00 ` Robert A Duff
1997-06-16 0:00 ` John G. Volan
1997-06-17 0:00 ` Robert A Duff
1997-06-25 0:00 ` Van Snyder
1997-06-17 0:00 ` Robert I. Eachus
1997-06-17 0:00 ` Robert Dewar
1997-06-17 0:00 ` Robert A Duff
1997-06-18 0:00 ` Spam Hater
1997-06-20 0:00 ` Robert Dewar
1997-06-21 0:00 ` Robert A Duff
1997-06-21 0:00 ` Robert Dewar
1997-06-20 0:00 ` Robert Dewar
1997-06-25 0:00 ` Wolfgang Gellerich
1997-06-25 0:00 ` Michael F Brenner
1997-06-26 0:00 ` Wolfgang Gellerich
1997-06-25 0:00 ` Samuel T. Harris
1997-06-19 0:00 ` Karel Th�nissen
1997-06-19 0:00 ` Karel Th�nissen
1997-06-23 0:00 ` John G. Volan
1997-06-23 0:00 ` Robert Dewar
1997-06-24 0:00 ` Brian Rogoff
1997-06-25 0:00 ` Featuritis not always bad (was re: GOTO considered necessary) Karel Th�nissen
1997-06-26 0:00 ` Robert Dewar
1997-06-26 0:00 ` Karel Th�nissen
1997-06-23 0:00 ` GOTO considered necessary (reworked) Spam Hater
1997-06-25 0:00 ` Karel Th�nissen
1997-06-23 0:00 ` John G. Volan
1997-07-21 0:00 ` Shmuel (Seymour J.) Metz
1997-06-13 0:00 ` Robert A Duff
1997-06-14 0:00 ` Samuel Mize
1997-06-14 0:00 ` Matthew Heaney
1997-06-14 0:00 ` Samuel Mize
1997-06-14 0:00 ` Robert Dewar
1997-06-16 0:00 ` Robert A Duff
1997-06-17 0:00 ` Spam Hater
1997-06-17 0:00 ` Robert A Duff
1997-06-19 0:00 ` Spam Hater
1997-06-17 0:00 ` Robert Dewar
1997-06-17 0:00 ` Spam Hater
1997-06-17 0:00 ` Robert A Duff
1997-06-19 0:00 ` John Herro
1997-06-25 0:00 ` Function result Van Snyder
1997-06-27 0:00 ` Jon S Anthony
1997-06-27 0:00 ` Robert Dewar
1997-06-20 0:00 ` GOTO considered necessary (reworked) Robert Dewar
1997-06-16 0:00 ` Spam Hater
1997-06-17 0:00 ` Robert Dewar
1997-06-17 0:00 ` Spam Hater
1997-06-16 0:00 ` Anonymous
1997-06-16 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox