comp.lang.ada
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
Subject: Re: A suggestion for resource management
Date: Sun, 22 Aug 2010 17:09:29 +0200
Date: 2010-08-22T17:09:29+02:00	[thread overview]
Message-ID: <87r5hqhefq.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: Pine.LNX.4.64.1008221453530.32484@medsec1.medien.uni-weimar.de

> I don't quite why this needs an extra pragma -- your example is, 
> apparently, easy to handle by current Ada's capacities:
>
>           procedure New_Test_External_Formats is
>              ...
>              COBOL_File : File_Type;
>
>              procedure Close_Cobol_File is
>              begin
>                 Close(COBOL_FILE);
>              end Close_Cobol_File;
>
>              Finisher: Finish_Package.Finisher;
>                -- The type Finish_Package.Finisher is derived from 
>                -- Ada.Finalization.Limited_Controlled. 
>              ...

Or even this:

       COBOL_File : File_Type;
       package Finisher_COBOL_File is
         new Finisher (File_Type, COBOL_File, Close);

That's actually quite nice, and can be implemented in Ada 2005.
Unfortunately, GNAT still generates horrible code for this case, but
that can be fixed.  (One trivial improvement is to use your Finisher
type in the implementation of the Finisher package; further
improvements need some compiler work.)



      parent reply	other threads:[~2010-08-22 15:09 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
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 [this message]
replies disabled

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