From: David Morton <dmorton@jinx.sckans.edu>
Subject: Can a generic conatain another generic
Date: 1996/04/26
Date: 1996-04-26T00:00:00+00:00 [thread overview]
Message-ID: <3180C808.63F1A041@jinx.sckans.edu> (raw)
A little question... can a generic package
contain another generic package?
In particular, I have an integer type declared
in a file_IO package, which a management package uses.
The management package uses another screen_IO package
for, you guessed it, screen io. The trouble is, I need
to prompt for that integer type, making the screen_IO package
have to "with" the file_IO package. I really don't want
these two packages to have any inter-dependencies,
so it seems to me that I need the screen_IO to have a generic function,
instantiated with the management prog. But the screen_IO
package will *also* have to instantiate Text_IO.Integer_IO.
any ideas how to do this?
I tried something like:
generic
type Integer_Type is <>;
function Get_Index_Prompt(prompt : in string) return Integer_Type is
Index_IO is new Text_IO.Integer_IO(Integer_Type);
...
but it needs a type where the <> is.
private won't work, cause the instantiation of Text_IO.Integer_IO
needs an integer type.
private integer won't work either... somehow I need to tell the
generic declaration that Integer_Type *will* be an integer.
but I can't just say "Integer" because it is only a particular integer type...
The only other way to fix this is with a type cast in the management
program, which, I believe, is usually frowned upon.
any suggestions?
--
David Morton
mailto:dmorton@jinx.sckans.edu // If you use Netscape 2.0,
205 College, Winfield, KS 67156 // you can click on the mailto: part to reply!
(HINT, HINT) :)
next reply other threads:[~1996-04-26 0:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-04-26 0:00 David Morton [this message]
1996-04-29 0:00 ` Can a generic conatain another generic Tucker Taft
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox