comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Files and controlled types
Date: Mon, 10 Mar 2008 18:45:38 -0400
Date: 2008-03-10T18:45:38-04:00	[thread overview]
Message-ID: <wccr6einqp9.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: a6156c7b-2343-4a92-8559-0186d8d683f4@q78g2000hsh.googlegroups.com

Eric Hughes <eric.eh9@gmail.com> writes:

> On Mar 8, 3:22 pm, Maciej Sobczak <see.my.homep...@gmail.com> wrote:
>> File types are not Controlled.
> [...]
>> I would think that types associated with external resources should be
>> Controlled to facilitate resource management in the presence of
>> exceptions [...]
>
> The current file types are at an analogous abstraction level to the
> standard C library.  Ada could also use a file type analogous to that
> in the standard C++ library.  Both are relevant.

True.

Note that Ada's file handling predates finalization.  And Adam Beneschan
showed why it would be hard to "fix" things in an upward compatible way.

It's not hard to write your own file type, so that initialization opens
the file, and finalization closes it.  You can pass the file name as a
discriminant to the File_Type, or (now that Ada supports limited
constructor functions) you can use one or more functions to "construct"
an open file from a name or from whatever else you like.

- Bob



      reply	other threads:[~2008-03-10 22:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-08 21:22 Files and controlled types Maciej Sobczak
2008-03-08 21:56 ` gpriv
2008-03-09  3:12 ` Jeffrey R. Carter
2008-03-09 13:27   ` Maciej Sobczak
2008-03-10 15:37     ` Adam Beneschan
2008-03-10 21:45       ` Maciej Sobczak
2008-03-09 16:39   ` gpriv
2008-03-10 15:28 ` Eric Hughes
2008-03-10 22:45   ` Robert A Duff [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