From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.6 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,TO_NO_BRKTS_PCNT autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!water!watmath!clyde!att!rutgers!mit-eddie!uw-beaver!ssc-vax!adolph From: adolph@ssc-vax.UUCP (Mark C. Adolph) Newsgroups: comp.lang.ada Subject: Visibility question Keywords: enumerated, import, subtype Message-ID: <2223@ssc-vax.UUCP> Date: 14 Sep 88 02:53:21 GMT Organization: Boeing Aerospace Corp., Seattle WA List-Id: Given the following package specs, I'm getting errors which I'm confused about: 1 package Test_Pack_One is 2 3 type Enum_Type is (one, three, five, seven, nine); 4 5 end Test_Pack_One; 6 7 with Test_Pack_One; 8 package Test_Pack_Two is 9 10 subtype Enum_Type is Test_Pack_One.Enum_Type; 11 12 first_enum : Enum_Type := three; 13 second_enum : Enum_Type := Enum_Type'(three); 14 third_enum : Test_Pack_One.Enum_Type := 15 Test_Pack_One.Enum_Type'(three); 16 17 end Test_Pack_Two; Test_Pack_Two produces errors on the declarations of all three objects. The DEC Ada compiler says: 10 subtype Enum_Type is Test_Pack_One.Enum_Type; 11 12 first_enum : Enum_Type := three; .......................................1 %ADAC-E, (1) three is not declared [LRM 8.3] %ADAC-I, (1) Possibly a selected component of (or use clause for) package Test_Pack_One in Test_Pack_One at line 1 is intended; this would make enumeral three in Test_Pack_One at line 3 visible 13 second_enum : Enum_Type := Enum_Type'(three); ..................................................1 %ADAC-E, (1) three is not declared [LRM 8.3] %ADAC-I, (1) Possibly a selected component of (or use clause for) package Test_Pack_One in Test_Pack_One at line 1 is intended; this would make enumeral three in Test_Pack_One at line 3 visible 14 third_enum : Test_Pack_One.Enum_Type := 15 Test_Pack_One.Enum_Type'(three); .....................................................1 %ADAC-E, (1) three is not declared [LRM 8.3] %ADAC-I, (1) Possibly a selected component of (or use clause for) package Test_Pack_One in Test_Pack_One at line 1 is intended; this would make enumeral three in Test_Pack_One at line 3 visible The InterACT VAX/1750A cross-compiler, though less verbose, agrees: Detected near line 12 *** 435E-2: Identifier THREE is not visible Detected near line 13 *** 435E-2: Identifier THREE is not visible Detected near line 15 *** 435E-2: Identifier THREE is not visible Am I missing something, or is a USE clause absolutely required here? How can a type be visible, via either a SUBTYPE declaration or a WITH and selection, but not its values? Finally, assuming that this is correct, what is the rationale? -- -- Mark A. ...uw-beaver!ssc-vax!adolph