comp.lang.ada
 help / color / mirror / Atom feed
From: "Norman H. Cohen" <ncohen@watson.ibm.com>
Subject: Re: How to hide instantiation of Direct_IO?
Date: 1997/02/20
Date: 1997-02-20T00:00:00+00:00	[thread overview]
Message-ID: <330CCC71.DFD@watson.ibm.com> (raw)
In-Reply-To: 5dqt5n$j3s$1@goanna.cs.rmit.edu.au


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




  reply	other threads:[~1997-02-20  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-02-11  0:00 How to hide instantiation of Direct_IO? Dale Stanbrough
1997-02-20  0:00 ` Norman H. Cohen [this message]
1997-02-22  0:00   ` Robert Dewar
1997-02-25  0:00     ` Norman H. Cohen
1997-02-25  0:00       ` Robert Dewar
1997-02-27  0:00         ` Norman H. Cohen
1997-03-01  0:00           ` Richard Kenner
1997-03-01  0:00             ` Robert Dewar
1997-03-02  0:00               ` Fergus Henderson
1997-03-02  0:00                 ` Robert Dewar
replies disabled

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