comp.lang.ada
 help / color / mirror / Atom feed
From: Brian Rogoff <bpr@shell5.ba.best.com>
Subject: Re: End of File for streams
Date: 2000/04/17
Date: 2000-04-17T00:00:00+00:00	[thread overview]
Message-ID: <Pine.BSF.4.21.0004171051070.25198-100000@shell5.ba.best.com> (raw)
In-Reply-To: 8dfgv8$2ta$1@nnrp1.deja.com

On Mon, 17 Apr 2000, Robert Dewar wrote:

> In article <8df15j$e4b$1@trog.dera.gov.uk>,
>   "Kevin Rigotti" <rigotti@atc.dera.gov.uk> wrote:
> > I have philosophical and aesthetic objections to trapping the
> > End_Error exception as a means of determining end of file, but
> > is this the only way to do it?
> 
> It's always odd when you have a situation where Ada provides
> an approach X to solving problem Y that works in a perfectly
> straightforward manner, and then asks
> 
> How can I do Y without using X, because I don't want to use X.
> 
> That's the situation you are in here. Catching End_Error is a
> clean solution to your problem and is the recommended approach.
> It is also often the more efficient approach compared to an
> explicit end of file test in the loop.

I agree that catching End_Error is the correct solution, but in Kevin's 
defense, many (Ada) programmers are taught that exceptions are only for 
error processing and not control flow, and giving the exception a name 
like "End_Error" rather than, say, "End_Of_Stream" doesn't help matters
any. 

-- Brian






  reply	other threads:[~2000-04-17  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-17  0:00 End of File for streams Kevin Rigotti
2000-04-17  0:00 ` Gautier
2000-04-17  0:00 ` Robert Dewar
2000-04-17  0:00   ` Brian Rogoff [this message]
2000-04-17  0:00 ` Gautier
2000-04-18  0:00   ` Kevin Rigotti
2000-04-17  0:00     ` Robert I. Eachus
2000-04-18  0:00     ` Robert Dewar
2000-04-18  0:00     ` Jean-Pierre Rosen
2000-04-18  0:00       ` Brian Rogoff
2000-04-18  0:00         ` Jean-Pierre Rosen
2000-04-19  0:00           ` Brian Rogoff
replies disabled

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