comp.lang.ada
 help / color / mirror / Atom feed
From: "Norman H. Cohen" <ncohen@watson.ibm.com>
Subject: Re: Q. on Automatic Package Finalization
Date: 1996/10/04
Date: 1996-10-04T00:00:00+00:00	[thread overview]
Message-ID: <32552646.F27@watson.ibm.com> (raw)
In-Reply-To: dewar.843919951@schonberg


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




  reply	other threads:[~1996-10-04  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-09-28  0:00 Q. on Automatic Package Finalization Robert Dewar
1996-10-04  0:00 ` Norman H. Cohen [this message]
1996-10-04  0:00   ` Robert Dewar
  -- 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-22  0:00 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   ` Jens Jakob Jensen
1996-09-25  0:00   ` Norman H. Cohen
replies disabled

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