comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@gnat.com
Subject: Re: Stream venting (long)
Date: 1998/12/31
Date: 1998-12-31T00:00:00+00:00	[thread overview]
Message-ID: <76g9ql$uvs$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 368B6D96.D728F0B7@erols.com

In article <368B6D96.D728F0B7@erols.com>,
  LeakyStain <leakstan@erols.com> wrote:
> You could implement a lock using a Controlled type, where
> Initialize locks and Finalize unlocks, giving this usage:
>
>     declare
> 	Stream_Locker;
>     begin
> 	stream use
>     end;
>
> That way, you don't have to worry about unlocking on
> exceptions. I suspect Ted Dennison still won't be happy.


I am not sure what would make Ted happy here, he seems to
expect some kind of impossible magic :-)

Note incidentally that internally, GNAT provides a cleanup
handler possibility, the pseudo-syntax (e.g. that provided
by -gnatG or -gnatdg in older versions) is

   begin
      ...
   at end
      ...
   end;

and the stuff in the "at end" handler is guaranteed to be
done on any exit from the block including an exceptional
exit. We use this all the time for internal expansions,
and it is tempting to make it available as a language
extension (under control of the -gnatX switch of course :-)

Robert Dewar
Ada Core Technologies

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




  reply	other threads:[~1998-12-31  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-28  0:00 Stream venting (long) dennison
1998-12-29  0:00 ` robert_dewar
1998-12-29  0:00   ` dennison
1998-12-29  0:00     ` robert_dewar
1998-12-30  0:00       ` dennison
1998-12-30  0:00         ` robert_dewar
1998-12-30  0:00           ` dennison
1998-12-31  0:00             ` robert_dewar
1998-12-31  0:00               ` LeakyStain
1998-12-31  0:00                 ` dewar [this message]
1998-12-31  0:00                   ` dennison
replies disabled

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