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,FREEMAIL_FROM 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-27 10:07:05 PST From: Dmitriy Anisimkov Newsgroups: comp.lang.ada Subject: Re: I/O - exception handling Date: Tue, 27 May 2003 23:50:42 +0700 Organization: A poorly-installed InterNetNews site Distribution: world Message-ID: References: NNTP-Posting-Host: 195.162.53.2 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ns.omskelecom.ru 1054054211 29163 195.162.53.2 (27 May 2003 16:50:11 GMT) X-Complaints-To: usenet@ns.omskelecom.ru NNTP-Posting-Date: Tue, 27 May 2003 16:50:11 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en In-Reply-To: Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!nntp-relay.ihug.net!ihug.co.nz!news-out.nuthinbutnews.com!propagator2-sterling!news-in.nuthinbutnews.com!news.rosprint.net!radius!not-for-mail Xref: archiver1.google.com comp.lang.ada:37847 Date: 2003-05-27T23:50:42+07:00 List-Id: Sergey Koshcheyev wrote: > I hereby promise I won't ignore the I/O exceptions in real code (or at > least I'll try not to :-)), that example was just an example. Ok, If so you do not need to suppress exception, let it go further if it is occured in Close. > Again, you have to remember to close the file in two places. Yes, I miss a bit "final" Borland Delphi reserver word too, but I think it is not big deal. You could have a local procedure for the finalization of Local allocated resources, and call it twice, from end of procedure and in the exception handler. Maybe Ada200X would have a something like "final" in Borland Delphi. Is there somebody who think that the syntax like declare Resource : Resource_Type; begin Open (Resource); Use_This (Resource); exception when Constraint_Error => Do_Something; final if Is_Open (Resource) then Close (Resource); end if; end; Is bad or not safe ? Where block from "final" to "end" would be executed in both cases, normal and any-exceptional.