* Instantiating Ada Generic Packages
@ 1990-03-29 4:44 Paul Bailes
1990-03-29 13:55 ` Mike Feldman
0 siblings, 1 reply; 2+ messages in thread
From: Paul Bailes @ 1990-03-29 4:44 UTC (permalink / raw)
Dear colleagues,
I have a problem with Ada generics. Consider the following situation:
package A is
type B is <C.D>;
package C is is new E (B);
end;
and
generic
type F is private;
package E is
type D is private;
private
type G;
type D is access G;
end;
with
package body E is
type G is <F>
end;
(the notation <X> means a code fragment including X)
The problem is that type B depends upon C.D, which itself comes
from the instantiation of E with B - a potential circularity, that
is forbidden by Ada - the above code is (I think) illegal, because
the <C.D> in package A precedes the declaration of C (by the
instantiation of E).
However, the circularity is not an objective problem because C.D
is only an access to the use of B (formal parameter F used in
full type declaration of private G to which D is an access).
From a language designer's point of view, one could imagine a development
of Ada that separated the instantiation of a generic package spec. from
that of the corresponding body: the above would then appear of some form
in which the package spec. instantiates only the generic spec:
package A is
package C is new E (any actual params for the spec. only);
type B is <C.D>;
end;
plus a body that instantiates the generic body:
package body A is
package body C is new E (B);
end;
plus the generic spec. with spec.-only parameters:
generic
any formal params for the spec. only
package E is
type D is private;
private
type G;
type D is access G;
end;
plus the generic body that needs actual param B (from the 1st package spec.)
generic
type F is private;
package body E is
type G is <F>
end;
My questions are
(1) is my perception of my problem a correct one?
(2) why doesn't Ada have separate instantiation of
generic package specs. and bodies?
(3) how can I do what I want WITHOUT having to
expand the generic ``by hand'', in effect to
achieve the separation of instantiations of
specs. and bodies that I desire?
I look forward to reading your solutions on the news!
Thanks in advance,
Paul A. Bailes
Dept. Computer Science
University of Queensland QLD 4072
Australia
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Instantiating Ada Generic Packages
1990-03-29 4:44 Instantiating Ada Generic Packages Paul Bailes
@ 1990-03-29 13:55 ` Mike Feldman
0 siblings, 0 replies; 2+ messages in thread
From: Mike Feldman @ 1990-03-29 13:55 UTC (permalink / raw)
Aaaaahhhhhhhhh.......
a technical question! At last!
Sorry I can't answer it right off the bat, but I sure am grateful that
you asked it!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1990-03-29 13:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1990-03-29 4:44 Instantiating Ada Generic Packages Paul Bailes
1990-03-29 13:55 ` Mike Feldman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox