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,4f2ff548f619cc58 X-Google-Attributes: gid103376,public From: Brian Rogoff Subject: Re: End of File for streams Date: 2000/04/17 Message-ID: #1/1 X-Deja-AN: 612333314 References: <8df15j$e4b$1@trog.dera.gov.uk> <8dfgv8$2ta$1@nnrp1.deja.com> Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: nntp1.ba.best.com 955995572 222 bpr@206.184.139.136 MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-04-17T00:00:00+00:00 List-Id: On Mon, 17 Apr 2000, Robert Dewar wrote: > In article <8df15j$e4b$1@trog.dera.gov.uk>, > "Kevin Rigotti" 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