From: BRYAN@SU-SIERRA.ARPA (Doug Bryan)
Subject: design problem/?
Date: Fri, 13-Sep-85 02:08:44 EDT [thread overview]
Date: Fri Sep 13 02:08:44 1985
Message-ID: <8509130608.AA02281@UCB-VAX.ARPA> (raw)
Hello expert Ada designers,
I could use your suggestions. This is the design problem:
Consider a heavily layered system. One of the lower level packages
exports a limited type. The higher levels are all abstractions
of the operations avaiable at all lower levels. Thus higher level
packages must reference the limited type and will export operations
in this reference. The reference will be used in all parameter
modes.
The problem is, what type do the higher level packages use to
reference the lower level limited type?
For example:
with text_io;
package file_stuff is
type a_file is limited private;
procedure x (file : in out a_file);
...
private
type a_file somehow maps to text_io.file_type;
end file_stuff;
I have been using access types:
type a_file is access text_io.file_type;
This method has its limitations, for instance if the implementation of
the limited type is an unconstrained record (all objects created using
allocation are contrained).
Another method involves arrays:
private
max_files : constant := 100;
type a_file is range 1 .. max_files;
...
package body file_stuff is
the_files : array (a_file) of text_io.file_type;
...
The limitations to the array solution are obvious: fixed max number of
objects, lots of memory used when it may not need be ( of the user only
needs 2 files)....
what do you think??
doug
-------
next reply other threads:[~1985-09-13 6:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1985-09-13 6:08 Doug Bryan [this message]
[not found] <BRYAN@SU-SIERRA.ARPA>
1985-09-13 18:35 ` design problem/? GBOOCH
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox