comp.lang.ada
 help / color / mirror / Atom feed
* ambiguous names
@ 2002-08-20 14:50 Maxim Reznik
  2002-08-20 15:15 ` David C. Hoos
  0 siblings, 1 reply; 4+ messages in thread
From: Maxim Reznik @ 2002-08-20 14:50 UTC (permalink / raw)


Trying to understand paragraph 4.1.3.13 of ARM:

* If the prefix does not denote a package, then it shall be a 
*direct_name or an expanded name, and it shall resolve to denote a 
*program unit (other than a package), the current instance of a type, a 
*block_statement, a loop_statement, or an accept_statement (in the case 
*of an accept_statement or entry_body, no family index is allowed); the 
*expanded name shall occur within the declarative region of this 
*construct. Further, if this construct is a callable construct and the 
*prefix denotes more than one such enclosing callable construct, then 
*the expanded name is ambiguous, independently of the selector_name.

I wroute a program:

procedure A is
    B : Boolean;
    X : Integer;

    procedure A is
       B : Integer;
    begin
       X := A.B;  -- ambiguous ?
    end A;

begin
    null;
end A;

I think there is an ambiguous name A.B in assignment statement.
"A" denotes two procedures and they are callable constructs.
But GNAT doesnt complain.

Could Ada lawyers explain me my fault and/or give me an example
of ambiguity of a prefix?

Please





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

* Re: ambiguous names
  2002-08-20 14:50 ambiguous names Maxim Reznik
@ 2002-08-20 15:15 ` David C. Hoos
  2002-08-20 17:55   ` Pascal Obry
  2002-08-21  7:05   ` Maxim Reznik
  0 siblings, 2 replies; 4+ messages in thread
From: David C. Hoos @ 2002-08-20 15:15 UTC (permalink / raw)


The inner A hides the outer A within the scope of the inner A.
Thus, there is no ambiguity.
----- Original Message ----- 
From: "Maxim Reznik" <max1@mbank.com.ua>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada.eu.org>
Sent: Tuesday, August 20, 2002 9:50 AM
Subject: ambiguous names


> Trying to understand paragraph 4.1.3.13 of ARM:
> 
> * If the prefix does not denote a package, then it shall be a 
> *direct_name or an expanded name, and it shall resolve to denote a 
> *program unit (other than a package), the current instance of a type, a 
> *block_statement, a loop_statement, or an accept_statement (in the case 
> *of an accept_statement or entry_body, no family index is allowed); the 
> *expanded name shall occur within the declarative region of this 
> *construct. Further, if this construct is a callable construct and the 
> *prefix denotes more than one such enclosing callable construct, then 
> *the expanded name is ambiguous, independently of the selector_name.
> 
> I wroute a program:
> 
> procedure A is
>     B : Boolean;
>     X : Integer;
> 
>     procedure A is
>        B : Integer;
>     begin
>        X := A.B;  -- ambiguous ?
>     end A;
> 
> begin
>     null;
> end A;
> 
> I think there is an ambiguous name A.B in assignment statement.
> "A" denotes two procedures and they are callable constructs.
> But GNAT doesnt complain.
> 
> Could Ada lawyers explain me my fault and/or give me an example
> of ambiguity of a prefix?
> 
> Please
> 
> 
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
> 




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

* Re: ambiguous names
  2002-08-20 15:15 ` David C. Hoos
@ 2002-08-20 17:55   ` Pascal Obry
  2002-08-21  7:05   ` Maxim Reznik
  1 sibling, 0 replies; 4+ messages in thread
From: Pascal Obry @ 2002-08-20 17:55 UTC (permalink / raw)



"David C. Hoos" <david.c.hoos.sr@ada95.com> writes:

> The inner A hides the outer A within the scope of the inner A.
> Thus, there is no ambiguity.

Right and to access outer one you must use "Standard.A.B".

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|         http://perso.wanadoo.fr/pascal.obry
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



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

* Re: ambiguous names
  2002-08-20 15:15 ` David C. Hoos
  2002-08-20 17:55   ` Pascal Obry
@ 2002-08-21  7:05   ` Maxim Reznik
  1 sibling, 0 replies; 4+ messages in thread
From: Maxim Reznik @ 2002-08-21  7:05 UTC (permalink / raw)


David C. Hoos wrote:
> The inner A hides the outer A within the scope of the inner A.
> Thus, there is no ambiguity.


> ----- Original Message ----- 
> Subject: ambiguous names
> 
>>Trying to understand paragraph 4.1.3.13 of ARM:
>>
[skip]

Thank you!
Now I see my mistake. And right example of such ambiguous is

procedure A(C : Integer)  is
     B : Boolean;
     X : Integer;

     procedure A is
        B : Integer;
     begin
        X := A.B;  -- ambiguous !
     end A;

begin
     null;
end A;

Now GNAT points to ambiguous prefix.

Max




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

end of thread, other threads:[~2002-08-21  7:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-20 14:50 ambiguous names Maxim Reznik
2002-08-20 15:15 ` David C. Hoos
2002-08-20 17:55   ` Pascal Obry
2002-08-21  7:05   ` Maxim Reznik

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