comp.lang.ada
 help / color / mirror / Atom feed
From: mfeldman@seas.gwu.edu (Michael Feldman)
Subject: Re: is there a 'wait' command in Ada
Date: 1996/12/01
Date: 1996-12-01T00:00:00+00:00	[thread overview]
Message-ID: <57smdo$9qv@felix.seas.gwu.edu> (raw)
In-Reply-To: dewar.849411873@merv


In article <dewar.849411873@merv>, Robert Dewar <dewar@merv.cs.nyu.edu> wrote:
>michael feldman says
>
>"delay 1.0;
>
>will usually work. Compiler? Platform? Sometimes the behavior is a
>bit unexpected, so more info will help us to help you."
>
>I don't get it, delay 1.0 must work on any implementation of Ada, what
>do you have in mind here Mike?

OK, you asked for it...:-)

One would think that a simple delay followed by a Put would be platform-
independently portable, but in this case the devil turns out to be in
the details.:-)

The delay will work, of course, but the poster's question was "how
do I pause my program before displaying a message?" Exactly when the 
output will appear may be surprising. Sometimes a Flush is needed to 
force it to the screen, for example.

Moreover, when running GNAT under GDB, including any tasking stuff 
causes surprising behavior (or no behavior at all), and delay is
part of the tasking stuff in GNAT, etc., etc. 

I was quite interested by this question. Some (including Robert) 
have asserted that using delay just to pause an interactive program 
was not a very interesting idea. Evidently others think otherwise.

I've argued that delay is a useful statement, completely independent of 
its RM introduction in the tasking chapter. Indeed, my book is crazy
enough to use delay in several examples as a "pause" statement. This 
has turned out to be a bit of a thorn in my students' sides, because 
at GW, our intro courses run everything under GDB, which is hidden in 
a script to produce a nice traceback on an unhandled exception.

GNAT, for better or worse, links in delay - even a simple delay in a 
non-tasking program - as part of the tasking runtime. Because of the
unfriendly relations between tasking and GDB, programs that use
simple delays don't work under our scripts. We've ended up writing
a package called Sleep_Package, which exports a procedure Sleep
that just uses a simple Unix sleep call. That works fine, but the
students scratch their heads about why they have to change their code
because the Ada in the book doesn't behave as advertised.

Well, Robert, you asked the question, so I had to answer it.:-)

Mike Feldman




  reply	other threads:[~1996-12-01  0:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-11-29  0:00 is there a 'wait' command in Ada ***** LOTUS *****
1996-11-29  0:00 ` Robert A Duff
1996-11-30  0:00 ` Michael Feldman
1996-11-30  0:00   ` Robert Dewar
1996-12-01  0:00     ` Michael Feldman [this message]
1996-12-01  0:00       ` Robert Dewar
1996-12-02  0:00         ` Larry Kilgallen
1996-12-02  0:00         ` Michael Feldman
1996-12-02  0:00       ` David C. Hoos, Sr.
1996-12-09  0:00         ` Fergus Henderson
1996-12-02  0:00 ` Corey Minyard
1996-12-03  0:00   ` Larry Kilgallen
1996-12-03  0:00     ` Michael Feldman
1996-12-04  0:00       ` Larry Kilgallen
1996-12-03  0:00   ` Michael Feldman
1996-12-03  0:00   ` Robert A Duff
1996-12-03  0:00 ` Corey Minyard
1996-12-04  0:00   ` Keith Thompson
1996-12-04  0:00   ` Robert Dewar
1996-12-10  0:00 ` Robert I. Eachus
  -- strict thread matches above, loose matches on Subject: below --
1996-11-29  0:00 tmoran
replies disabled

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