comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@goldfinger.mitre.org (Robert I. Eachus)
Subject: Re: Language lawyer needed
Date: Fri, 2 Apr 1993 16:40:13 GMT
Date: 1993-04-02T16:40:13+00:00	[thread overview]
Message-ID: <EACHUS.93Apr2114013@goldfinger.mitre.org> (raw)
In-Reply-To: davidg@oracorp.com's message of Thu, 1 Apr 1993 21:57:53 GMT

In article <1993Apr1.215753.3147@oracorp.com> davidg@oracorp.com (David Guaspari) writes:

  > Consider the following pathological program:

      procedure Q(x : integer) is  
      begin
	declare
	  x : integer;   -- (1)
	begin
	  Q(x => 0);     -- (2)
	end;
      end Q;

  > My question concerns the legality of Q (forgetting about the fact that
  > its execution won't terminate).  One way to apply chapter 8 in the
  > reference manual goes as follows:

  >   The declaration of x in (1) hides the declaration of x as a formal
  >   parameter of Q.

  So the name of the parameter is no longer directly visible, but is
visible only by selection.  Okay.

  >   Therefore, by the visibility rules, the occurrence of x in (2) has
  >   exactly one possible meaning, namely that given by the declaration
  >   in (1). 

  >   However, the declaration in (1) is not visible by selection at the
  >   point at which x occurs in (2).

  >   Therefore the call in (2) is illegal.

  Nope.  8.3(6 & 11) say:

  Visibility is either by selection or direct.  A declaration is
visible by selection at places that are defined as follows.

  (e)  For a parameter specification of a given subprogram declaration
or entry declaration:  at the place of the formal parameter (before
the compound delimiter =>) in a named parameter association of a
corresponding subprogram or entry call.

   So not only is the parameter X visible by selection, it is the only
X visible so there is no problem.  The terminology here is a little
misleading.  The or in 8.3(6) is not a choice, it really stands for
"there are locations where visibility is determined using the rules
for selection, other rules apply everywhere else."  The first sentence
of paragraph 8.3(14) is the offender here, it is technically correct
but misleading: "Where it is not visible by selection, a visible
declaration is said to be _directly_ visible."  It says that
visibility by selection preempts direct visibility, but seems to say
that it applies on a name by name basis, rather than to the process of
visibility as a whole.



--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...



  parent reply	other threads:[~1993-04-02 16:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-04-01 21:57 Language lawyer needed David Guaspari
1993-04-02 13:57 ` Dave Collard x7468
1993-04-02 16:40 ` Robert I. Eachus [this message]
1993-04-02 19:37 ` Tucker Taft
1993-04-02 23:07 ` Rich Messenger
  -- strict thread matches above, loose matches on Subject: below --
1993-04-02 15:39 Mike Berman
1993-04-02 16:39 Wes Groleau X7574
1993-04-07 22:34 agate!howland.reston.ans.net!zaphod.mps.ohio-state.edu!pacific.mps.ohio-s
1993-04-08 18:10 Robert I. Eachus
1993-04-09 22:33 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!noc.n
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox