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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,37d1760a19f7ae57 X-Google-Attributes: gid103376,public From: "Norman H. Cohen" Subject: Re: Q. on Automatic Package Finalization Date: 1996/10/04 Message-ID: <32552646.F27@watson.ibm.com>#1/1 X-Deja-AN: 187532262 references: content-type: text/plain; charset=us-ascii organization: IBM Thomas J. Watson Research Center mime-version: 1.0 reply-to: ncohen@watson.ibm.com newsgroups: comp.lang.ada x-mailer: Mozilla 3.0 (Win95; I) Date: 1996-10-04T00:00:00+00:00 List-Id: Robert Dewar wrote: > "> begin > > ... > > exception > > ... > > at end > > < sequence of frame finalization statements > > > end" > > Interestingly, internally GNAT implements at end, but does not allow it > to be mixed with an exception handler, and at end, unlike an exception > handler, covers the associated declarations. Both those differences detract from the value of "at end". First, the principal purpose of "at end" is to ensure that frame finalization ALWAYS takes place, whether the frame is exited by reaching the end of the frame, by handling an exception, by propagating an unhandled exception, or by some nonlocal transfer of control (goto, exit, return, requeue). Second, if the "at end" statements are entered because of an exception part way through the elaboration of declarations, some of the variables visible in the "at end" section may not have been elaborated, so using them in the frame finalization will be unsafe. That is why the Ada rules have an exception in a declarative part propagate an exception rather than tranferring control to a handler of the same construct as the declarative part; the same consideration applies to frame finalization. > It would be trivial (but a bit naughty) to make this available as a language > extension :-) More than a bit! -- Norman H. Cohen mailto:ncohen@watson.ibm.com http://www.research.ibm.com/people/n/ncohen