comp.lang.ada
 help / color / mirror / Atom feed
* Not visible
@ 2009-06-24  9:37 Pietro Tornaindietro
  2009-06-24  9:56 ` Georg Bauhaus
  2009-06-24  9:59 ` Niklas Holsti
  0 siblings, 2 replies; 3+ messages in thread
From: Pietro Tornaindietro @ 2009-06-24  9:37 UTC (permalink / raw)


hi, i'm a newbie.

i'm using APQ.

ith APQ.PostgreSQL, APQ.PostgreSQL.Client;
with Ada.exceptions;
with Text_IO;
use Text_IO;
use Ada.exceptions;
with APQ.PostgreSQL, APQ.PostgreSQL.Client;

procedure aa33 is
   use APQ.PostgreSQL, APQ.PostgreSQL.Client;

   C : Connection_Type;
begin
	Connect(C);

exception
   when Not_Connected =>


and when i compile this code, gnat tells me " "Not_Connected" is not
visible".

what's the problem?
i searched in google for this problem but no answers.

thanks in advance

-- 

questo articolo e` stato inviato via web dal servizio gratuito 
http://www.newsland.it/news segnala gli abusi ad abuse@newsland.it





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

* Re: Not visible
  2009-06-24  9:37 Not visible Pietro Tornaindietro
@ 2009-06-24  9:56 ` Georg Bauhaus
  2009-06-24  9:59 ` Niklas Holsti
  1 sibling, 0 replies; 3+ messages in thread
From: Georg Bauhaus @ 2009-06-24  9:56 UTC (permalink / raw)


Pietro Tornaindietro schrieb:
> hi, i'm a newbie.
> 
> i'm using APQ.
> 
> ith APQ.PostgreSQL, APQ.PostgreSQL.Client;
> with Ada.exceptions;
> with Text_IO;
> use Text_IO;
> use Ada.exceptions;
> with APQ.PostgreSQL, APQ.PostgreSQL.Client;
> 
> procedure aa33 is
>    use APQ.PostgreSQL, APQ.PostgreSQL.Client;
> 
>    C : Connection_Type;
> begin
> 	Connect(C);
> 
> exception
>    when Not_Connected =>
> 
> 
> and when i compile this code, gnat tells me " "Not_Connected" is not
> visible".
> 
> what's the problem?


Where is Not_Connected declared?
In case it is declared in APQ, the declarations of APQ
aren't visible directly.  "use P1.P2" makes the declarations
of P2 directly visible, but not those of P1.
In case there are two declarations of exception Not_Connected,
one in APQ.PostgreSQL and one in APQ.PostgreSQL.Client (though
I'd doubt it), then making both names directly visible by
"use"ing both packages leads to a conflict.



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

* Re: Not visible
  2009-06-24  9:37 Not visible Pietro Tornaindietro
  2009-06-24  9:56 ` Georg Bauhaus
@ 2009-06-24  9:59 ` Niklas Holsti
  1 sibling, 0 replies; 3+ messages in thread
From: Niklas Holsti @ 2009-06-24  9:59 UTC (permalink / raw)


Pietro Tornaindietro wrote:
> hi, i'm a newbie.
> 
> i'm using APQ.

Yes... and no, see below :-)

> 
> procedure aa33 is
>    use APQ.PostgreSQL, APQ.PostgreSQL.Client;
...
> exception
>    when Not_Connected =>
> 
> 
> and when i compile this code, gnat tells me " "Not_Connected" is not
> visible".
> 
> what's the problem?

The exception Not_Connected seems to be declared in the package 
APQ, which you do not "use". So either add "use APQ" to the 
use-clauses, or qualify the exception name:

    exception
       when APQ.Not_Connected =>

There is a difference here in the Ada language between the "with" 
clause and the "use" clause: when you "with" a child package, as in

    with APQ.PostgreSQL;

you implicitly "with" the parent, APQ. But when you "use" a child 
package, as in your

     use APQ.PostgreSQL, ...

the parent package APQ is not implicitly "used", so its entities 
are not visible without qualification by "APQ.xxx".

HTH,

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .



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

end of thread, other threads:[~2009-06-24  9:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-24  9:37 Not visible Pietro Tornaindietro
2009-06-24  9:56 ` Georg Bauhaus
2009-06-24  9:59 ` Niklas Holsti

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