From: bf14@prism.gatech.edu ("none")
Subject: instantiation from an instantiation
Date: 1997/03/08
Date: 1997-03-08T00:00:00+00:00 [thread overview]
Message-ID: <5fskee$a0@acmey.gatech.edu> (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
reply other threads:[~1997-03-08 0:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox