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,37d1760a19f7ae57 X-Google-Attributes: gid103376,public From: jjjensen@cybernet.dk (Jens Jakob Jensen) Subject: Re: Q. on Automatic Package Finalization Date: 1996/09/25 Message-ID: #1/1 X-Deja-AN: 185142391 references: <523tt4INNlu7@snoopy.cis.ohio-state.edu> content-type: text/plain; charset=ISO-8859-1 organization: Ozwix Data mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-09-25T00:00:00+00:00 List-Id: In article <324837B8.2361@watson.ibm.com>, "Norman H. Cohen" wrote: [snippety-snip] >The feature we considered during the 9X design, by the way, was simple, >succinct, and intuitive: Everywhere Ada allows > > begin > ... > exception > ... > end > >we would have allowed > > begin > ... > exception > ... > at end > < sequence of frame finalization statements > > end > >The semantics would have been the same as the > > try { ... } catch { ... } finally { ... } > >construct in Java or > > TRY > TRY > ... > EXCEPT > ... > END > FINALLY > ... > END > >in Modula-3: The frame-finalization statements get executed both after >normal exit from a frame and after execution of an exception handler for >the frame. Does this include leaving the frame by return and abort ? I haven't looked enough into these languages, I'm afraid. If not, one could do something like: procedure P is ... procedure Finalize is ... end Finalize; ... begin ... Finalize; exception when ... => ... Finalize; when others => Finalize; raise; end P; You have to be really sloppy to miss calling "Finalize" when adding an exception handler later on. But it _will_ happen, of course... >Norman H. Cohen >mailto:ncohen@watson.ibm.com >http://www.research.ibm.com/people/n/ncohen ----------------------------------------------------------------------------- -- jjjensen@cybernet.dk (current) -- -- Jens_Jakob_Jensen@mailhost.net (permanent, thanks to www.pobox.org.sg) -- -----------------------------------------------------------------------------