comp.lang.ada
 help / color / mirror / Atom feed
* Ada language problem/question
@ 1986-07-07 19:15 Burch Seymour
  1986-07-09 15:18 ` esmith
  1986-07-09 15:52 ` Joe Orost
  0 siblings, 2 replies; 3+ messages in thread
From: Burch Seymour @ 1986-07-07 19:15 UTC (permalink / raw)



>>>>> Lion eater food <<<<<

Could someone help me determine if the error in the following Ada code
is in the code or a compiler bug. I have reason to do the following,
package A - Declares an enumeration type
package B - Creates a subtype that is eqivalent to the original
package C - Assigns values using the enumeration values of A into a
            variable of the subtype declared in B.
I won't bore you with why I must do it this way as opposed to just
using the original type in package C, but I must. My compiler
generates an undeclared identifier error in the front end, and I can't 
tell whether the LRM scoping rules say this is valid or not. Anyone have
any ideas? Any help will be appreciated.
------------------------------------------------------------------------
package A is
type my_type is (st_1,st_2,st_3);
end A;

package body A is
x : my_type;
begin
x := st_1; -- no errors here
end A;
------------------------------------------------------------------------
with A;
package B is
subtype my_type is a.my_type;
end B;

Package body B is
y : my_type;
begin
y := A.st_2;  -- no errors here
end B;
------------------------------------------------------------------------
with B;
package C is
I : B.my_type;  -- type is OK but appears to fail to bring along
                -- enumeration values (see below). The question is...
                -- should it?
end C;

Package body C is
begin
I := B.st_3;   -- undeclared identifier error on this assign
               -- sites section 8.3 of LRM
end c;
------------------------------------------------------------------------
-- 
-------------------------------------------------------------------------
  "A nation that beats its swords into plowshares generally ends up
    doing the plowing for one that has kept it swords."  Anon

Burch Seymour -Gould C.S.D. at   ....mcnc!rti-sel!gould!bseymour
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1986-07-09 15:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1986-07-07 19:15 Ada language problem/question Burch Seymour
1986-07-09 15:18 ` esmith
1986-07-09 15:52 ` Joe Orost

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