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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d8a4797a79f9c90f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-26 22:33:31 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newshub.sdsu.edu!newsfeed2.earthlink.net!newsfeed.earthlink.net!wn14feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc01.POSTED!not-for-mail Message-ID: <3ED2F8A3.6070806@attbi.com> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: I/O - exception handling References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.62.164.137 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc01 1054013606 24.62.164.137 (Tue, 27 May 2003 05:33:26 GMT) NNTP-Posting-Date: Tue, 27 May 2003 05:33:26 GMT Organization: AT&T Broadband Date: Tue, 27 May 2003 05:33:26 GMT Xref: archiver1.google.com comp.lang.ada:37822 Date: 2003-05-27T05:33:26+00:00 List-Id: Preben Randhol wrote: > > OK understand. *I* would then do: > > procedure Safe_Close (File : File_Type)... > > Now you can use the Safe_Close in any function you like. I have "decorated" open and close routines that I keep copying around and using in even simple utilities because even the most minimal code to open a file, check that the open succeeded, or print a diagnotic if it didn't runs to over a page. But I haven't considered these things as a good candidate for standardization because there are just too many different text strings--and personal preferences--involved. The other problem is that the open routine can't exit from the enclosing procedure, so after printing a diagnostic, it has to reraise the exception (or raise some other exception). This is fine if the program can't run without an input file, but there are other cases where you might want to continue. Gets complicated, but that is the nature of a file that may or may not exist, and may not be accessable due to permissions, or may be open by some other program for writing and so on. The only conclusion I have reached is that there is no such thing as "simply" opening a file.