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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,904f3551267aacb0 X-Google-Attributes: gid103376,public From: "Norman H. Cohen" Subject: Re: How to hide instantiation of Direct_IO? Date: 1997/02/20 Message-ID: <330CCC71.DFD@watson.ibm.com>#1/1 X-Deja-AN: 220331447 References: <5dqt5n$j3s$1@goanna.cs.rmit.edu.au> Content-Type: text/plain; charset=us-ascii Organization: IBM Thomas J. Watson Research Center Mime-Version: 1.0 Reply-To: ncohen@watson.ibm.com Newsgroups: comp.lang.ada X-Mailer: Mozilla 3.0 (Win95; I) Date: 1997-02-20T00:00:00+00:00 List-Id: Dale Stanbrough wrote: > > I'ld like to develop a package on top of the rather low level Direct_IO, > but prevent access to the instantiation of Direct_IO itself. > > I could do this by instantiating direct_io in a private part of a > package, and then declare higher level routines in child packages which > for the most part, simply forward the work onto the equivalent direct_io > routines. > > However there seems no way to declare a type Count for my higher level > package such that it has the same range as that defined in Direct_IO > (type Count is 0..implementation-defined) - I can't reference the > private instantiation - 'cos it's private! This is one of those relatively unusual occasions on which one misses the ability to interleave private and public declarations, as in C++. Why not declare an integer type with the maximal range, i.e., type Count is range 0 .. System.Max_Int; and use that? (One drawback is that your equivalent of Set_Index will have to include a run-time check for an index that is larger than the underlying machinery can handle, i.e., larger than Count'Last, but there are already such run-time checks for the file-index values passed to the Direct_IO procedures Read and Write, as described in RM A.8.5(4) and A.8.5(7).) -- Norman H. Cohen mailto:ncohen@watson.ibm.com http://www.research.ibm.com/people/n/ncohen