comp.lang.ada
 help / color / mirror / Atom feed
From: mojsys!joevl@uunet.uu.net  (Joe Vlietstra)
Subject: LRM 4.1.3 paragraphs 17-19
Date: 9 Feb 91 02:39:13 GMT	[thread overview]
Message-ID: <1991Feb09.023913.524@mojsys.com> (raw)

In article <1991Feb8.063458.850@kestrel.edu> gyro@kestrel.edu (Scott Layson) writes:
>It has to do with paragraphs 18 and 19 of section 4.1.3.
>(Please refer to the manual at this point.)  Paragraph 17 talks
>about four kinds of named constructs whose names can be used as
>the prefix of an expanded name.  Paragraphs 18 and 19 give
>additional rules about only two of those kinds of constructs,
>viz., subprograms and accept statements.  What about block
>statements and loop statements?
>
>Scott Burson
>Gyro@Reasoning.COM

When the LRM is unclear, check the "Approved Ada Language
Commentaries" (published in ACM Ada Letters, Vol IX, No 3, 1989).

For your specific problem, check commentary AI-0016.
This commentary addresses prefixes for renamed packages.
But the discussion section describes how to interpret 4.1.3, and
ends with the statement:
  In short, since the Standard is unclear on the legality of
  such names, and since implementations tend to allow them, it
  is reasonable to interpret the Standard as allowing such names.
When in doubt, be permissive.

In the case of block statements and loop statements, the only
restrictions are those imposed by the scoping rules.  Variables
declared within a block cannot be referenced outside of the block,
even with a prefix.
Loop statements implicitly declare a variable: the loop index.
So the following works (but may get the programmer fired):
	LOOP1:
	for I in 1..10 loop
	   LOOP2:
	   for I in 1..10 loop
	      X (LOOP1.I,LOOP2.I) := 100.0;
	   end loop LOOP2;
	end loop LOOP1;
But LOOP1.I cannot be referenced outside of the loop.
Hope this helps.
------------------------------------------------------------------
Joe Vlietstra        | Checked Daily:  ...!uunet!mojsys!joevl
Mojave Systems Corp  | Checked Weekly: mojave@hmcvax.claremont.edu
1254 Harvard Avenue  | Iffy Routing:   joevl@mojsys.com
Claremont, CA 91711  ! Voice:          (714) 621-7372
------------------------------------------------------------------
-- 
------------------------------------------------------------------
Joe Vlietstra        | Checked Daily:  ...!uunet!mojsys!joevl
Mojave Systems Corp  | Checked Weekly: mojave@hmcvax.claremont.edu
1254 Harvard Avenue  | Iffy Routing:   joevl@mojsys.com

         reply	other threads:[~1991-02-09  2:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-02-08  6:34 Ada Test Tools Scott Layson
1991-02-09  2:39 ` Joe Vlietstra [this message]
1991-02-11 14:57   ` LRM 4.1.3 paragraphs 17-19 Michael Feldman
1991-02-12  9:48     ` (George C. Harrison) Norfolk State University
1991-02-12 19:13       ` Michael Feldman
1991-02-12 21:44         ` Billy Yow 283-4009
1991-02-13  4:32           ` Michael Feldman
1991-02-13 16:32             ` jncs
1991-02-15  4:11     ` Jim Showalter
  -- strict thread matches above, loose matches on Subject: below --
1991-02-14  3:41 Michael Feldman
replies disabled

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