From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ee2e271b166c2587 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Files and controlled types Date: Mon, 10 Mar 2008 18:45:38 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <3bd96475-530b-46a7-9b07-11ea49105b2c@e31g2000hse.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1205189139 29358 192.74.137.71 (10 Mar 2008 22:45:39 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 10 Mar 2008 22:45:39 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:1MLqiNBxUTl1ByTtB81pE4nXAhI= Xref: g2news1.google.com comp.lang.ada:20284 Date: 2008-03-10T18:45:38-04:00 List-Id: Eric Hughes writes: > On Mar 8, 3:22 pm, Maciej Sobczak 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