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: 24 Dec 92 11:48:52 GMT From: agate!spool.mu.edu!darwin.sura.net!Sirius.dfn.de!chx400!sicsun!disuns2!lg lsun!nebbe@ucbvax.Berkeley.EDU (Robb Nebbe) Subject: Re: Visibility Message-ID: <1992Dec24.124852@lglsun.epfl.ch> List-Id: In article <1992Dec24.021655.22555@beaver.cs.washington.edu>, pattis@cs.washing ton.edu (Richard Pattis) writes: |> In article <1992Dec23.233519.21523@netfs.dnd.ca> BERRYMAN@orca.drep.dnd.ca ( DON BERRYMAN) writes: |> > |> > |> >I have a quesiton on Visiblity. The following Ada code |> >generates the following error. |> > |> > |> > package datatypes is |> > subtype widget is integer; |> > end datatypes; |> > |> > with datatypes; |> > package testvisibility is |> > function widget (a: integer) return datatypes.widget; |> > end testvisibility; |> > |> |> The LRM says in 8.3(16) "every declaration with the same designator" is |> hidden. And designators are only identifiers or operator symbols. So it look s |> like your designator widget, even when declared in another package and |> selected, is still hidden. There are two notes on this, but both involve |> generics |> |> Now, can anyone say why this interpretation "is a good thing". |> |> Rich Pattis |> I think the rule is intended as the simplest way of preventing someone from writing the following: function widget (A : integer := widget) return integer; This prevents the compiler from having to figure out what the designator corresponds to and whether or not it should be legal. The above code obviously won't work but how about: function widget (A : integer := widget(1)) return integer; I think they wanted to avoid all these legalistic problems and so they just came up with the simplest rule possible that eliminated the problem. If people think that Ada is hairy now they should just imagine if it had rules like: Within the specification of a function, every declaration with the same designator as the function that is found as a default value in the parameter list is hidden; ... I would think rules like this would be a compiler writers nightmare. Robb Nebbe nebbe@lglsun.epfl.ch