* Strongly coupled generic children?
@ 1996-04-23 0:00 Joerg Rodemann
1996-04-23 0:00 ` Michel Gauthier
1996-04-24 0:00 ` Pascal Ledru
0 siblings, 2 replies; 3+ messages in thread
From: Joerg Rodemann @ 1996-04-23 0:00 UTC (permalink / raw)
Hi folks!
Playing around with generics I stumbled over the following problem:
1.) I have a generic library unit x providing some key data of my problem
Generic parameter: e.g. floating point type
generic
type Floating is digits <>;
package x is
...
end x;
2.) Added to this is a child package x.y which provides some tables
used just for a small number of modules (This is different for x).
generic
package x.y is
...
procedure SomeWhat;
...
end x.y;
3.) Now I want to add another child unit x.z that provides some further
information. This module needs access to the data contained in x.y
but I do not want to put it into x.y because x.z may be exchanged
by some other package (that possibly also uses x.y).
Is there some way to do something like the following?
with x.y;
generic
package x.z is
...
procedure DoSomething;
...
end x.z;
package body x.z is
...
procedure DoSomething is
begin
...
x.y.SomeWhat;
...
end DoSomething;
...
end x.z;
Is it possible in Ada-95 to build up such a library structure? Or do I
have to deliver an instantiation of x.y as a generic parameter to x.z in
its instantiation?
Any help appreciated
Thanks
George
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Strongly coupled generic children?
1996-04-23 0:00 Strongly coupled generic children? Joerg Rodemann
@ 1996-04-23 0:00 ` Michel Gauthier
1996-04-24 0:00 ` Pascal Ledru
1 sibling, 0 replies; 3+ messages in thread
From: Michel Gauthier @ 1996-04-23 0:00 UTC (permalink / raw)
In article <4lib04$juq@rigel.rz.uni-ulm.de>,
rodemann@mathematik.uni-ulm.de (Joerg Rodemann) wrote:
>> Hi folks!
>>
>> Playing around with generics I stumbled over the following problem:
>>
>> 1.) I have a generic library unit x providing some key data of my problem
>> Generic parameter: e.g. floating point type
>> [...]
>> 2.) Added to this is a child package x.y which provides some tables
>> used just for a small number of modules (This is different for x).
>> [...]
>> 3.) Now I want to add another child unit x.z that provides some further
>> information. This module needs access to the data contained in x.y
>> but I do not want to put it into x.y because x.z may be exchanged
>> by some other package (that possibly also uses x.y).
>> Is there some way to do something like the following?
>> [...]
>> Is it possible in Ada-95 to build up such a library structure? Or do I
>> have to deliver an instantiation of x.y as a generic parameter to x.z in
>> its instantiation?
>>
>> Any help appreciated
This is a problem that I reached, too.
The solution that came to my mind is also to pass X.Y as a package
parameter of X.Z,
as you suggest. It worked in one case, but I got many gnat crashes in most
cases.
For some projects, the workaround to these crashes have been to declare
many _private_ entities in the root, and install renamings or similar in the
childs. I am aware that it is no more than a workaround.
---------- ---------- ---------- ----------
Michel Gauthier / Laboratoire d'informatique
123 avenue Albert Thomas / F-87060 Limoges
telephone +33 () 55457335 [or ~ 7232]
fax +33 () 55457315 [or ~7201]
---------- ---------- ---------- ----------
La grande equation de la fin du siecle : windows-X = Mac-Y
The main end-of-century equation : windows-X = Mac-Y
---------- ---------- ---------- ----------
Si l'an 2000 est pour vous un mysticisme stupide, utilisez la base 9
If you feel year 2000 a stupid mystic craze, use numeration base 9
---------- ---------- ---------- ----------
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Strongly coupled generic children?
1996-04-23 0:00 Strongly coupled generic children? Joerg Rodemann
1996-04-23 0:00 ` Michel Gauthier
@ 1996-04-24 0:00 ` Pascal Ledru
1 sibling, 0 replies; 3+ messages in thread
From: Pascal Ledru @ 1996-04-24 0:00 UTC (permalink / raw)
What about using a formal package as a parameter of X.Z:
generic
type P1_Type is private;
package P1 is
procedure MainProc;
end P1;
generic
package P1.Y is
procedure Somewhat;
end p1.Y;
with P1.Y;
generic
with package P1Y is new P1.Y(<>);
package P1.Z is
procedure DoSomething;
end;
package body P1.Z is
procedure Dosomething is
begin
p1Y.Somewhat;
end;
end;
with P1;
with P1.Y;
with P1.Z;
package test is
package I1 is new P1(P1_Type => Integer);
package I2 is new I1.Y;
package I3 is new I1.Z(P1Y => I2);
end;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1996-04-24 0:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-04-23 0:00 Strongly coupled generic children? Joerg Rodemann
1996-04-23 0:00 ` Michel Gauthier
1996-04-24 0:00 ` Pascal Ledru
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox