🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.ada
Article #858

Ada language problem/question

#858
From: Burch Seymour
Date: Mon, 07 Jul 1986 19:15
56 lines
2511 bytes
>>>>> 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
-------------------------------------------------------------------------
Technical Details
Message-ID: <91@houligan.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!lll-crg!lll-lcc!vecpyr!amd!pesnta!peora!ucf-cs!novavax!houligan!bseymour

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!lll-crg!lll-lcc!vecpyr!amd!pesnta!peora!ucf-cs!novavax!houligan!bseymour
From: bseymour@houligan.UUCP (Burch Seymour)
Newsgroups: net.lang.ada
Subject: Ada language problem/question
Message-ID: <91@houligan.UUCP>
Date: Mon, 7-Jul-86 15:15:25 EDT
Article-I.D.: houligan.91
Posted: Mon Jul  7 15:15:25 1986
Date-Received: Wed, 9-Jul-86 02:02:26 EDT
Organization: Gould Electronics, Ft. Lauderdale, Florida.
Lines: 56