comp.lang.ada
 help / color / mirror / Atom feed
* Partial generic instanciation
@ 2006-10-28 10:41 Yves Bailly
  2006-10-28 13:03 ` Robert A Duff
  0 siblings, 1 reply; 2+ messages in thread
From: Yves Bailly @ 2006-10-28 10:41 UTC (permalink / raw)


Hello all,

I didn't find anywhere any reference to this, but I'm wondering
anyway : is it possible to do partial generic instanciation, 
something like partial template instanciation in C++ ?

Say for example you have a package like this :

generic
   type T_1 is private;
   type T_2 is private;
package Pkg is
-- ....
end Pkg;

Is it possible to declare a new package with something like :

with Pkg;
generic
   type TT is private;
package Pkg_Int is new Pkg(T_1 => Integer, T_2 => TT);

I *know* this actually doesn't compile, but is there some syntax I'm
not aware of to achieve this ?

Best regards,

-- 
(o< | Yves Bailly  : http://kafka-fr.net   | -o)
//\ | Linux Dijon  : http://www.coagul.org | //\
\_/ |                                      | \_/`



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

* Re: Partial generic instanciation
  2006-10-28 10:41 Partial generic instanciation Yves Bailly
@ 2006-10-28 13:03 ` Robert A Duff
  0 siblings, 0 replies; 2+ messages in thread
From: Robert A Duff @ 2006-10-28 13:03 UTC (permalink / raw)


Yves Bailly <kafka.fr@laposte.net> writes:

> generic
>    type T_1 is private;
>    type T_2 is private;
> package Pkg is
> -- ....
> end Pkg;
>
> Is it possible to declare a new package with something like :
>
> with Pkg;
> generic
>    type TT is private;
> package Pkg_Int is new Pkg(T_1 => Integer, T_2 => TT);

No, not directly.  But you can do this:

generic
   type TT is private;
package Pkg_Int is
    package P is new Pkg(T_1 => Integer, T_2 => TT);
end Pkg_Int;

- Bob



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

end of thread, other threads:[~2006-10-28 13:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-28 10:41 Partial generic instanciation Yves Bailly
2006-10-28 13:03 ` Robert A Duff

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