comp.lang.ada
 help / color / mirror / Atom feed
* SOS find the bug....
@ 1993-01-20 11:03 enterpoop.mit.edu!eru.mt.luth.se!kth.se!sunic!mcsun!julienas!corton!geocu
  0 siblings, 0 replies; 2+ messages in thread
From: enterpoop.mit.edu!eru.mt.luth.se!kth.se!sunic!mcsun!julienas!corton!geocu @ 1993-01-20 11:03 UTC (permalink / raw)


Hi.

I am meeting a problem with ADA compilation for which we don't know the clue.
Could you help me to solve it ?

Here the specifications....

generic

	type	LABEL1 is limited private ;
	type	TO_LABEL2 is limited private ;
	type	TO_LABEL3 is limited private ;
	

package PACK1 is

-- =====================================================
	generic
	      type LABEL2 is limited private ;
		
	package PACK2 is
-- =====================================================
	      	generic
			type LABEL3 is limited private ;

		package PACK3 is
			type RECORD3 is limited private ;
			procedure PROC3 ( In_Record3 : in RECORD3 ) ;

		private
			type RECORD3 is record
			     LAB3 : LABEL3 ;
		       end record ;

		end PACK3 ;			

-- =====================================================
						
         package PACK3_INST is new PACK3 ( LABEL3 => TO_LABEL3 ) ;
	 use PACK3_INST ;

	 type RECORD2 is limited private ;

	 procedure PROC2 ( In_Record2 : in RECORD2 ;
	       	       	   In_Record3 : in RECORD3 ) ;

	 private

	 	type RECORD2 is record
		     LAB2 : LABEL2 ;
		     REC3 : RECORD3 ;
		end record ;

	 end PACK2 ;
-- ======================================================

   	package PACK2_INST is new PACK2 ( LABEL2 => TO_LABEL2 ) ;

	use PACK2_INST ;	--  the problem must be here
	use PACK3_INST ;	--  ... why ????
	
	type RECORD1 is limited private ;

	procedure PROC1 ( In_Record1 : in RECORD1 ) ;

	private
		type RECORD1 is record
		     LAB1 : LABEL1 ;
		     REC2 : RECORD2 ;
		end record ;

end PACK1 ;

.............................................................................
...... and the body

package body PACK1 is

	package body PACK2 is

		package body PACK3 is 

		procedure PROC3 ( In_Record3 : in RECORD3 ) is
		begin
			null ;
	        end PROC3 ;

		end PACK3 ;

-- if I don't use the expression
--     procedure PROC2 ( In_Record2: in RECORD2 ;
--    	                 In_Record3: in PACK3_INST.RECORD3 ) is
-- I get a compilation error message (see below)
--

        procedure PROC2 ( In_Record2: in RECORD2 ;
	      	      	  In_Record3: in RECORD3 ) is
	begin
		null ;
	end PROC2 ;

	end PACK2 ;

procedure PROC1 ( In_Record1 : in RECORD1 ) is
begin
	null ;
end PROC1 ;

end PACK1 ;
	  

...............................................................................
.... finally the error message ....

  14:        procedure PROC2 ( In_Record2: in RECORD2 ;
  15:	      	      	  In_Record3: in RECORD3 ) is
A -------------------------------------^
A:error: RM 8.3: identifier undefined
A:error: RM 8.4(6): Potentially visible declarations cancel:
A:error: 	record3, line 28 in pack3 from file /u3/houillon/PROJETS/ADA/GR
APHES/PACK_GRAPH/bug-ads.a
A:error: 	record3, line 28 in pack3 from file /u3/houillon/PROJETS/ADA/GR
APHES/PACK_GRAPH/bug-ads.a


OK it's a *little bit* tricky, but I'd like to understand where's the problem.

Thanx a lot for your answers.

					a puzzled ADA novice

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
So if you want my address, it's number one at the end of the bar,
where I sit with the broken angels, clutching at straws and nursing our scars.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

* Re: SOS find the bug....
@ 1993-01-22  0:38 Pascal Obry
  0 siblings, 0 replies; 2+ messages in thread
From: Pascal Obry @ 1993-01-22  0:38 UTC (permalink / raw)


Christian,

Like you have noticed, it's only a problem of visibility.

You make the generic package visible into the package PACK1.

	by a : use PACK3_INST;

But you didn't into the package body PACK1.

(see LRM 8.4 about use clause and the visibility)


>		package body PACK3 is 
>
>		procedure PROC3 ( In_Record3 : in RECORD3 ) is

  *** Here RECORD3 is visible since it is inside the package 

>		begin
>			null ;
>	        end PROC3 ;
>
>		end PACK3 ;
>
>-- if I don't use the expression
>--     procedure PROC2 ( In_Record2: in RECORD2 ;
>--    	                 In_Record3: in PACK3_INST.RECORD3 ) is
>-- I get a compilation error message (see below)
>--
>

   *** Since PROC2 is outside the PACK3 ...
   *** you should add : use PACK3_INST;
   *** to have the visibility of RECORD3

>        procedure PROC2 ( In_Record2: in RECORD2 ;
>	      	      	  In_Record3: in RECORD3 ) is
>	begin
>		null ;
>	end PROC2 ;


Hope this help,
Pascal.
--

-------------------------------------------------------------------------------
--  Pascal OBRY								     --
--  Room 2D-337				e_mail : obry@bellcore.com  	     --
--  Bellcore								     --
--  445 South Street			voice : 1 - 201 829 4039	     --
--  Post Office Box 1910		FAX   : 1 - 201 829 5981	     --
--  Morristown, New Jersey 07962-1910					     --
-------------------------------------------------------------------------------

  `` inheritance is surely a good answer, but who knows the question ? ''

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

end of thread, other threads:[~1993-01-22  0:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-01-20 11:03 SOS find the bug enterpoop.mit.edu!eru.mt.luth.se!kth.se!sunic!mcsun!julienas!corton!geocu
  -- strict thread matches above, loose matches on Subject: below --
1993-01-22  0:38 Pascal Obry

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