From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 11 Sep 91 14:13:25 GMT From: agate!spool.mu.edu!news.cs.indiana.edu!arizona.edu!east.pima.edu!rharwood @ucbvax.Berkeley.EDU Subject: Re: why are these unknown identifiers? Message-ID: <1991Sep11.071325.1@east.pima.edu> List-Id: In article <9109101616.aa26718@PARIS.ICS.UCI.EDU>, jduarte@liege.ICS.UCI.EDU (Jose Duarte) writes: > package X is > type DIRECTIONS is (UP,DOWN,LEFT,RIGHT); > end X; > ----------------------------------------- > with X; > package Y is > subtype DIRECTIONS is X.DIRECTIONS; > end Y; > ----------------------------------------- > with TEXT_IO; > use TEXT_IO; > with Y; > procedure BUG is > V1 : Y.Directions := Y.UP; -- Y.UP is unknown > V2 : Y.Directions := Y.DOWN; -- Y.DOWN is unknown > begin > null; > end BUG; > Can someone tell me why "Y.UP" and "Y.DOWN" are unknown identifiers > within the procedure BUG? To answer your question, I propose that you temporarily change package Y to: with X; package Y is type DIRECTIONS is new X.DIRECTIONS; end Y; NOW you don't need X... the reason is that the IDENTIFIERS (for enumerated types) and the OPERATORS (for virtually all non-private types) are considered to be "declared" at the same scope of the TYPE declaration... and a subtype does NOT declare a new type. Therefore the SUBTYPE Y.DIRECTIONS is heavily dependent on the declaration of X.DIRECTIONS... while a TYPE Y.DIRECTIONS establishes the identifiers and operations inside the scope of Y. I hope I've communicated this well. Ray ----- Ray Harwood |Data Basix |Associate Faculty, Voice: (602)721-1988 |PO Box 18324 | Pima Community College FAX: (602)721-7240 |Tucson, AZ 85731 |Instructor in Ada and Pascal CompuServe: 76645,1370|AppleLink: DATA.BASIX|Internet: rharwood@east.pima.edu