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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d1df6bc3799debed X-Google-Attributes: gid103376,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: Syntax for tagged record types (was Re: Not intended for use in medical,) Date: 1997/05/28 Message-ID: #1/1 X-Deja-AN: 244410826 Distribution: world References: <3.0.32.19970423164855.00746db8@mail.4dcomm.com> <5kl9qc$g4d@bcrkh13.bnr.ca> <5kmek2$9re@bcrkh13.bnr.ca> <33727FA5.5C7A@sprintmail.com> <3374C19F.15FE@sprintmail.com> <3376CF85.3E15@sprintmail.com> <33828299.2A3@world.std.com> Organization: The Mitre Corp., Bedford, MA. Newsgroups: comp.lang.ada Date: 1997-05-28T00:00:00+00:00 List-Id: I said: > declare > The_File: New_IO.File_Access := > New_IO.Open(Name => "my_file.dat", Mode => In_Mode)'Access; > begin > > No reason you can't write that package if you want. I would have >the Open return a File_Access value, and would either have garbage >collection semantics (via reference counts) for File_Type, or just not >make it visible at all. But those are just details. In article mheaney@ni.net (Matthew Heaney) writes: > Good idea, but I was trying to avoid using heap. The thought that avoiding allocators in your code will avoid heap use when opening a file makes my head swim! Where does this insanity end? Does anyone know of a file system that allows "real" file objects to be deallocated or trashed by the user by accident? No? Okay, where do you think the real file buffers reside? On the user stack? On the system stack? How about in a system managed heap? On Unix, at least on Unix of a few years ago, I could have only twenty file descriptors open at a time. So use my suggestion above, disappear the File_Type from the user's view, and put everything into an array of twenty objects in the package body. What has this accomplished? Nothing. Much better would be to have an array of File_Access values and allocate objects from the heap when the file is opened, and deallocate them when the file is closed. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...