comp.lang.ada
 help / color / mirror / Atom feed
From: bseymour@houligan.UUCP (Burch Seymour)
Subject: Ada language problem/question
Date: Mon, 7-Jul-86 15:15:25 EDT	[thread overview]
Date: Mon Jul  7 15:15:25 1986
Message-ID: <91@houligan.UUCP> (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
-------------------------------------------------------------------------

             reply	other threads:[~1986-07-07 19:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1986-07-07 19:15 Burch Seymour [this message]
1986-07-09 15:18 ` Ada language problem/question esmith
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