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: 1 Jul 93 21:44:02 GMT From: rational.com!geneo@uunet.uu.net (Gene Ouye) Subject: Re: Question of Visibility Message-ID: <1993Jul1.214402.25611@rational.com> List-Id: Boris Pelakh (pelakh@convex.com) wrote: : I am trying to determine whether I am in the right (if I am not, I will have : to patch a compiler). Examine the following example : : with text_io; : package boolean_type_pkg is : type boolean is (FALSE, TRUE); : for boolean use (FALSE => 16#00#, TRUE => 16#ff#); : package boolean_io is new text_io.enumeration_io(boolean); : end boolean_type_pkg; : with boolean_type_pkg; use boolean_type_pkg; : procedure boolean_test is : flag : boolean := TRUE; : begin : boolean_io.put(flag); : end boolean_test; : My (Verdix-derived) front-end determines flag to be of type STANDARD.BOOLEAN. : I say that is correct since according to 8.1.11, STANDARD is an all-enclosing : declarative region, and thus has visibility precedence to the with'ed in pkg. : My customer claims that is wrong. Any opinions ? Alternatively, is there any : compiler out there that will accept the above code ? Mine rejects it since : boolean_io.put requires BOOLEAN_TYPE_PKG.BOOLEAN. : -- : Boris Pelakh Ada Project Leader pelakh@convex.com : Convex Computer Corporation : "If winning isn't important, why keep score ?" -- Lt. Worf, Star Trek TNG. : Boris, I believe that much of section 8.4 applies here as well as 8.1(11) -- especially paragraphs 4, 5, 8, and the example in paragraph 11. Also sections 8.3 and 8.6 seem applicable. In particular, 8.4(5) discussing declarations made visible by a use clause states: "A potentially visible declaration is not made directly visible if the place considered is within the immediate scope of a homograph of the delaration." And 8.4(8): "The above rules guarantee that a declaration that is made directly visible by a use clause cannot hide an otherwise directly visible declaration." 8.4(11): package D is T, U, V, : Boolean; end D; procedure P is package E is ... (elided for clarity) procedure Q is T, X : Real; use D, E; begin -- the name T means Q.T, not D.T ... (other comments elided) Relative to your example, I equate Boolean_Type_Pkg.Boolean to D.T above. (I recognize that Q.T and D.T are of different types and I don't think that that makes any difference WRT your example.) Also, as you noted, 8.1(11) states: "The package STANDARD forms a declarative region which encloses all library units: the implicit declaration of each library unit is assumed to occur immediately within this package". Thus, I equate Standard.Boolean to Q.T above (because it is in the declarative region immediately surrounding your procedure Boolean_Test (i.e., Standard)). I then conclude that Standard.Boolean should not be hidden by the use clause (as per 8.4(5) and 8.4(8)). BUT... as much as I would like to believe I am a language lawyer, compared to other posters in this newsgroup I am only a language law clerk. If anyone believes my post to be invalid, please correct me. One question: what is preventing you from using dotted notation in the declaration of flag? (never mind the obvious question of why do you need the use clause) Gene Ouye (geneo@rational.com) (301) 897-4014