From: esmith@gypsy.UUCP
Subject: Re: Ada language problem/question
Date: Wed, 9-Jul-86 11:18:00 EDT [thread overview]
Date: Wed Jul 9 11:18:00 1986
Message-ID: <38000031@gypsy.UUCP> (raw)
In-Reply-To: 91@houligan.UUCP
Your compiler does the right thing. A subtype declaration does not
derive any operations (read "enumeration literals"). If you change
the assignment in package B to y := st_2 or y := B.st_2 you will see
that the literals aren't locally defined in B, therefore they can't be
made available anywhere else through the use of a "with B".
Note that if you must do this, and a derived type won't do what you want,
you can use renaming declarations:
package fruit_mgr is
type fruit is (apple, banana, cherry);
end fruit_mgt;
with fruit_mgr;
package pseudo_fruit_mgr is
subtype fruit is fruit_mgr.fruit;
function apple return fruit renames fruit_mgr.fruit;
function banana return fruit renames fruit_mgr.banana;
function cherry return fruit renames fruit_mgr.cherry;
end pseude_fruit_mgr;
You can, of course, just declare constants of type pseudo_fruit_mgr.fruit
instead:
apple: constant fruit := fruit_mgr.apple;
but this method does not preserve the semantics of enumeration literals,
particularly with reference to overloading.
next prev parent reply other threads:[~1986-07-09 15:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1986-07-07 19:15 Ada language problem/question Burch Seymour
1986-07-09 15:18 ` esmith [this message]
1986-07-09 15:52 ` Joe Orost
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox