comp.lang.ada
 help / color / mirror / Atom feed
From: jjjensen@cybernet.dk (Jens Jakob Jensen)
Subject: Re: Q. on Automatic Package Finalization
Date: 1996/09/25
Date: 1996-09-25T00:00:00+00:00	[thread overview]
Message-ID: <oBISyExFEStK086yn@cybernet.dk> (raw)
In-Reply-To: dewar.843529239@schonberg


In article <324837B8.2361@watson.ibm.com>,
"Norman H. Cohen" <ncohen@watson.ibm.com> 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) --
-----------------------------------------------------------------------------




  parent reply	other threads:[~1996-09-25  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-09-22  0:00 Q. on Automatic Package Finalization david scott gibson
1996-09-23  0:00 ` Robert Dewar
1996-09-24  0:00   ` Norman H. Cohen
1996-09-24  0:00     ` Tucker Taft
1996-09-25  0:00   ` Norman H. Cohen
1996-09-25  0:00   ` Jens Jakob Jensen [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-09-28  0:00 Robert Dewar
1996-10-04  0:00 ` Norman H. Cohen
1996-10-06  0:00   ` Robert Dewar
1996-09-28  0:00 Robert Dewar
1996-10-04  0:00 ` Norman H. Cohen
1996-10-04  0:00   ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox