comp.lang.ada
 help / color / mirror / Atom feed
* instantiation from an instantiation
@ 1997-03-08  0:00 "none"
  0 siblings, 0 replies; only message in thread
From: "none" @ 1997-03-08  0:00 UTC (permalink / raw)



My program compiles fine but I'm getting a constraint error at run time.
I've isolated the problem to a package which is instantiated by another
package which is itself instantiated by the client program. 

The client program instantiates package_1

package my_package_1 is new package_1(thing_type => integer,"<" => "<"
                                       process => process);

*in addition to defining thing_type's type I want to use the usual 
definition of < in package_1 and process is a function declared in
the client program.

package_1 has it's own instantiation declaration of another package  
called package_2 that package_1 uses. All the same types/definitions
are passed on from package_1 to package_2.

package pak_1_package is new package_2(thing_type,"<",process);

package_2 is to be instantiated the same way as package_1 was. 
(i.e. the generics in package_2 is in the same order and have the same
names as in package_1). My question is: Can the instantiated terms be 
passed up this way?

Again to illustrate

/client_program.adb/

with package_1;use package_1;
procedure client_progragm is
   procedure process()
   begin
     null;
   end process; 
   package my_package_1 is new package_1(thing_type => integer,"<" = "<",
                                      process => process);
   .
   .
end client_program;
----------------------------------------------------------------------

/package_1.ads/

with package_2;
generic
  type thing_type is private;
  with function "<"(left,right:thing_type) return boolean;
  with procedure process(target:thing_type);  

package package_1 is

   package pak_1_package is new package_2(thing_type,"<",process);
   .
   .
end package_1;
------------------------------------------------------------------------

/package_2.ads/

generic
  type thing_type is private;
  with function "<"(left,right:thing_type) return boolean;
  with procedure process(target:thing_type);
package package_2 is 
.
.
end package_2;

/the constraint error pops up in package_2's body. My guess based on tests
I've done is somehow the instantiations are not passed up correctly.
i.e. thing_type is not integer, function "<" is not the usual "<" and 
process is not the process defined in the client./

Are the declarations basically correct and I should search for the error
elsewhere?

As an additional question is  set_col  part of standard ADA language or 
do I have to use "with" for another library?
-- 
Brian Franklin
Georgia Institute of Technology, Atlanta Georgia, 30332
uucp:	  ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!bf14
Internet: bf14@prism.gatech.edu




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-03-08  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-03-08  0:00 instantiation from an instantiation "none"

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