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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7728b533f7ab5fb6 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!news.wiretrip.org!border1.nntp.ams.giganews.com!nntp.giganews.com!feeder2.news.saunalahti.fi!feeder1.news.saunalahti.fi!nntp.inet.fi!central1.inet.fi!inet.fi!read4.inet.fi.POSTED!53ab2750!not-for-mail Sender: AWI003@FIW9752 Newsgroups: comp.lang.ada Subject: Re: Avoiding side effects References: From: Anders Wirzenius Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: Tue, 30 Sep 2008 09:20:23 GMT NNTP-Posting-Host: 194.251.142.2 X-Complaints-To: abuse@inet.fi X-Trace: read4.inet.fi 1222766423 194.251.142.2 (Tue, 30 Sep 2008 12:20:23 EEST) NNTP-Posting-Date: Tue, 30 Sep 2008 12:20:23 EEST Organization: Sonera Customer Xref: g2news1.google.com comp.lang.ada:2155 Date: 2008-09-30T09:20:23+00:00 List-Id: Jean-Pierre Rosen writes: > Anders Wirzenius a �crit : > [...] > > The problem is how to deal with the situation when I reach the > > end of the file. I have done it using a side effect: > > EOF_Reached : Boolean := False; > > loop > > Trans_String... > > exit when EOF_Reached; > > Trans_String... > > exit when EOF_Reached; > > end loop; > > -- Display possible tail of file A. > > EOF_Reached is set to True in the functions Strip and Advance as > > a side effect. > > Is there a better way without using the side effect EOF_Reached? > > > > Exceptions of course! Please don't feel like I am provocative. I just want to find out the difference between exceptions and side effects: Why is an exception in this case not considered to be a side effect? -- Anders