comp.lang.ada
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
Subject: Re: A suggestion for resource management
Date: Sat, 21 Aug 2010 21:47:05 +0200
Date: 2010-08-21T21:47:05+02:00	[thread overview]
Message-ID: <87d3tb7npi.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: 1q8io375n581c$.7mbvmavnyzyy$.dlg@40tude.net

* Dmitry A. Kazakov:

> On Sat, 21 Aug 2010 18:20:29 +0200, Florian Weimer wrote:
>
>>           procedure Test_External_Formats is
>>              ...
>>              COBOL_File : File_Type;
>>              ...
>> 
>>           begin
>>              Open (COBOL_File, Name => "Some_File");
>>              pragma Scoped (Close (COBOL_File));
>> 
>>              loop
>>                ...
>>           exception
>>              when End_Error => ...
>>           end Test_External_Formats;
>
> What is wrong with having a destructor for File_Type? If the language is to
> be extended why not to fix that first?

You can't always change libraries in that way.  Adding destructors has
both syntactic and run-time overhead.  The run-time overhead can be
minimized by a sufficiently advanced compiler (perhaps relying on
whole-program optimization to detect the lack of task aborts).  I'm
more concerned with the syntactic overhead.

There are some cases where the destructor solution doesn't really
apply.  For instance, the cleanup operation might need two parameters,
one denoting the object, and a second one decribing where to put it.



  reply	other threads:[~2010-08-21 19:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-21 16:20 A suggestion for resource management Florian Weimer
2010-08-21 19:07 ` Dmitry A. Kazakov
2010-08-21 19:47   ` Florian Weimer [this message]
2010-08-21 20:53     ` Dmitry A. Kazakov
2010-08-21 21:09       ` Florian Weimer
2010-08-22  6:40         ` Dmitry A. Kazakov
2010-08-23 23:22         ` Randy Brukardt
2010-08-21 20:34 ` Niklas Holsti
2010-08-21 21:01   ` Florian Weimer
2010-08-22 10:53     ` Niklas Holsti
2010-08-22 15:29       ` Florian Weimer
2010-08-22 16:12       ` Florian Weimer
2010-08-23 12:25         ` Niklas Holsti
2010-09-04 19:09           ` Florian Weimer
2010-09-07 10:14             ` Niklas Holsti
2010-08-22 11:32     ` Georg Bauhaus
2010-08-23 23:37       ` Randy Brukardt
2010-08-22 13:09 ` stefan-lucks
2010-08-22 14:30   ` Florian Weimer
2010-08-22 15:09   ` Florian Weimer
replies disabled

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