comp.lang.ada
 help / color / mirror / Atom feed
* Re: Language lawyer needed
@ 1993-04-08 18:10 Robert I. Eachus
  0 siblings, 0 replies; 10+ messages in thread
From: Robert I. Eachus @ 1993-04-08 18:10 UTC (permalink / raw)


In article <1993Apr7.183449.21551@sei.cmu.edu> dlehman@ajpo.sei.cmu.edu (Danfor
d Lehman) writes:


   Dan says:

  > NOT (which flip-flops the "false" asserted above, of course).  Indeed, I'll
  > argue that at the (precise) point of 'x' in "Q(x=>0);", the variable "x"
  > declaration is not visible at all (and thus that 8.3(14) ought to read

	>  A declaration is directly visible within a certain part
	>  of its immediate scope [which] extends to the end of the
	>  immediate scope of the declaration, but excludes places where the
	>  declaration is hidden as explained below or where visibility is
	>  determined by selection as explained above. ~~~~~~~~~~~~~~~~~~~
	   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    But you don't need to modify that sentence, just include the
(misleadingly worded) previous sentence: "Where it is not visible by
selection, a visible declaration is said to be directly visible..."
As I said before perfectly correct, but misleading.  Paragraphs
8.3(6-13) have dealt with the case where visiblity is by selection,
8.3(14-16) deals with direct visibility.  The first sentence defines
directly visible to be visibile, but not visible by selection. 8.3(6)
says that at certain places, the only things that are visible are
thoses visible by selection.

  >     If you hold that variable declaration "x" is visible at all,
-- It isn't.
  > and obviously formal parameter specification "x" is also,
-- the same.
  > don't you then contradict/conflict with 8.3(4), which allows more
  > than one meaning if and only if the identifier is acceptable
  > according to overloading rules (which don't apply in this case)?
  > Curious readers of 8.3 want to know, too!  (This is the reason for
  > the tilde underscored revision to 8.3 above.  Maybe 8.3(6) intends
  > to say this, that only one type of visibility is available at any
  > given point;

  It does.  If it didn't then the P's in P.P.P.P.P could all refer to
the same declaration.  (It is possible, but it is a pathological case:

 package Q is package P renames Q; end P;
 with Q; use Q; procedure P is pacakge R renames P.P.P.P.P;...
 
 see AI-187)

  > I read it to say rather/simply that there are two types of
  > visibility (and maybe at point P each can be applied and yield
  > ambiguity (in "package P is A : integer := 0; B : integer := P.A;
  > ... " this last A refers to the same decl. by either type of
  > visibility, and is thus not ambiguous)!?)

  You read it wrong, if I use your reading the following would be legal:

  with Text_IO;
  package C is
    A: Integer;
    B: Integer := Text_IO.A; -- legal? Of course not!
  end C;

  If the preceding A was directly visible at the point following
"Text_IO.", this would be a very different--and much more
confusing--language.  So, where visibility by selection applies,
NOTHING is directly visible.



--

					Robert I. Eachus

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

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: Language lawyer needed
@ 1993-04-09 22:33 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!noc.n
  0 siblings, 0 replies; 10+ messages in thread
From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!noc.n @ 1993-04-09 22:33 UTC (permalink / raw)


In article <1993Apr2.193753.22289@inmet.camb.inmet.com> 
 stt@spock.camb.inmet.com (Tucker Taft) writes:

>In article <1993Apr1.215753.3147@oracorp.com> 
>  davidg@oracorp.com (David Guaspari) writes:
>
>>Here's a question for language lawyers.
>
>Oh boy.
>
>>Consider the following pathological program:
>>
>>   procedure Q(x : integer) is  
>>   begin
>>     declare
>>       x : integer;   -- (1)
>>     begin
>>       Q(x => 0);     -- (2)
>>     end;
>>   end Q;
>>
>> . . .
>>  However, the declaration in (1) is not visible by selection at the
>>  point at which x occurs in (2).
>
>This statement is false.  

Oops; I misread David's original sentence -- it is in fact
true.  The declaration in (1) is not visible by selection preceding
the "=>" in (2).  (My misreading had replaced "the declaration in (1)"
with "the first declaration of x".)

The basic confusion illustrated by David's message
comes from the word "hide" which does *not* imply the 
earlier declaration is "invisible" 
but rather simply not *directly* visible (I guess it is 
"indirectly visible" ;-).  

On the other hand, "hide from *all* visibility" does 
mean the declaration is visible neither directly nor by selection.  
This more "obscure" (so to speak) kind of hiding only happens in a 
few cases (within a subprogram specification, and for implicit
declarations overridden by explicit declarations).
It is probably best to just ignore these obscure cases when
trying to build an "intuition" for what the word "hide" means
in Ada.  

(Perhaps a better word for "hide" might be the verb "obscure" ;-)

>>- David Guaspari
>>  davidg@oracorp.com
>
>S. Tucker Taft      stt@inmet.com
>Ada 9X Mapping/Revision Team
>Intermetrics, Inc.
>Cambridge, MA  02138

-S. T. Taft

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: Language lawyer needed
@ 1993-04-07 22:34 agate!howland.reston.ans.net!zaphod.mps.ohio-state.edu!pacific.mps.ohio-s
  0 siblings, 0 replies; 10+ messages in thread
From: agate!howland.reston.ans.net!zaphod.mps.ohio-state.edu!pacific.mps.ohio-s @ 1993-04-07 22:34 UTC (permalink / raw)


Dave Collard writes:

> The 'x' in (2) does not refer to a variable -- it is part of a named
> parameter association and has nothing to do with the visibility of either
> the formal parameter 'x' or the 'x' declared in (1). ...

   Half right:  it has everything to do with the formal parameter, whose
specification is the only applicable visible (by selection) declaration
of 'x' at that point!

Tuck writes:

TT >  However, the declaration in (1) is not visible by selection at the
TT >  point at which x occurs in (2).
TT
TT This statement is false.  Which paragraph in RM 8.3 made you think
TT it was true?  Curious revisers of 8.3 want to know...

NOT (which flip-flops the "false" asserted above, of course).  Indeed, I'll
argue that at the (precise) point of 'x' in "Q(x=>0);", the variable "x"
declaration is not visible at all (and thus that 8.3(14) ought to read

	A declaration is directly visible within a certain part
	of its immediate scope [which] extends to the end of the
	immediate scope of the declaration, but excludes places where the
	declaration is hidden as explained below or where visibility is
	determined by selection as explained above. ~~~~~~~~~~~~~~~~~~~
	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The relevant prg.s are:  8.3(6..12), 8.3(13), & 6.4(3).

  By 8.3(6..12), one finds no rules for visibility-by-selection that apply
  to the variable declaration "x".

  Which leaves only 8.3(14)'s "Finally, ..." as the one chance for vis-by-sel.
  But by 6.4(3) the only allowable name "at the point at which x occurs in (2)"
  is a name of a formal paramenter, right!?  So variable decl. "x" cannot be
  vis-by-sel at the point immediately between a subprogram call's left paren
  and compound delimiter '=>' in the parameter association.

   If you hold that variable declaration "x" is visible at all, and obviously
formal parameter specification "x" is also, don't you then contradict/conflict
with 8.3(4), which allows more than one meaning if and only if the identifier
is acceptable according to overloading rules (which don't apply in this case)?
Curious readers of 8.3 want to know, too!  (This is the reason for the tilde
underscored revision to 8.3 above.  Maybe 8.3(6) intends to say this, that
only one type of visibility is available at any given point; I read it to say
rather/simply that there are two types of visibility (and maybe at point P
each can be applied and yield ambiguity (in "package P is A : integer := 0;
B : integer := P.A; ... " this last A refers to the same decl. by either type
of visibility, and is thus not ambiguous)!?)

---Dan
------- *

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: Language lawyer needed
@ 1993-04-02 16:39 Wes Groleau X7574
  0 siblings, 0 replies; 10+ messages in thread
From: Wes Groleau X7574 @ 1993-04-02 16:39 UTC (permalink / raw)


Hey, everyone, please don't flame the poor guy!

<name withheld to prevent forest fires> writes:
>Here's a question for language lawyers.
>
>Consider the following pathological program:
>
>   procedure Q(x : integer) is  
>   begin
>     declare
>       x : integer;   -- (1)
>     begin
>       Q(x => 0);     -- (2)
>     end;
>   end Q;
>

The "x" in (2) is NOT a variable; it is there to tell the compiler (which
knows anyway) WHICH of the parameters of Q needs to get the value zero.
Study up in all your Ada books, including the LRM, about named associations,
if you really want to know about this.

On the other hand, if you're just nit-picking to make Ada look bad, it didn't
work: we adults can tell the difference between "bad" and "not perfect"



^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: Language lawyer needed
@ 1993-04-02 15:39 Mike Berman
  0 siblings, 0 replies; 10+ messages in thread
From: Mike Berman @ 1993-04-02 15:39 UTC (permalink / raw)



Arf! Sorry about that last posting - I just discovered that my
newsreader chokes on reposted dead.articles.

Here's the relevant part:

davidg@oracorp.com (David Guaspari) writes:
| Here's a question for language lawyers.

	Hopefully an Ada instructor will do.

| 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.
| 
|   Therefore, by the visibility rules, the occurrence of x in (2) has
|   exactly one possible meaning, namely that given by the declaration
|   in (1). 

|   Therefore the call in (2) is illegal.

Visibility is not defined for just identifiers. The section of the LRM
to which you are referring describes rules "for each identifier and at
each place in the text." Like the real estate biz, the important thing
in your example is location, location, location. The occurrence of
x in (2) clearly can only be a subprogram parameter for procedure Q.

-- 
Mike Berman
University of Maryland, Baltimore County	Fastrak Training, Inc.
berman@umbc.edu					(301)924-0050



^ permalink raw reply	[flat|nested] 10+ messages in thread
* Language lawyer needed
@ 1993-04-01 21:57 David Guaspari
  1993-04-02 13:57 ` Dave Collard x7468
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: David Guaspari @ 1993-04-01 21:57 UTC (permalink / raw)


Here's a question for language lawyers.

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.

  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.

One the other hand, at least one compiler (Telesoft) thinks that Q is
legal, an outcome that seems a reasonable enough outcome to common
sense untutored by the reference manual.  So, what *is* the right
answer, and how do we get it from the RM?

- David Guaspari
  davidg@oracorp.com



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~1993-04-09 22:33 UTC | newest]

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

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