From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Specialization generic package parameters
Date: Fri, 23 May 2008 19:29:49 +0200
Date: 2008-05-23T19:29:50+02:00 [thread overview]
Message-ID: <1996bbhvwjxcr$.1s16brw83713g$.dlg@40tude.net> (raw)
Recently I ran into the following problem with generic packages. Consider
type T is tagged null record;
and a generic package that uses it:
generic
type Some_T is new T with private;
package P is
...
private
...
end P;
Let there be some type S derived from T:
type S is new T with null record;
Now the question is, how to derive another package Q from P, specialized
for S, while keeping access to the private part of P?
Neither of patterns I know works.
1. Nested package:
generic
type Some_S is new S with private;
package Q is
package P_S is new P (Some_S); -- This specializes P
private
-- No access to the private part of P!
end Q;
2. Formal package:
generic
type Some_S is new S with private;
package P_S is new P (Some_S); -- This specializes P
package Q is
...
private
-- No access to the private part of P!
end Q;
3. Child package
generic
package P.Q is
private
-- Got access to the private part, but
-- lost specialization, as the parameter
-- of P is no more constrained to S.
end P;
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next reply other threads:[~2008-05-23 17:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-23 17:29 Dmitry A. Kazakov [this message]
2008-05-23 20:17 ` Specialization generic package parameters christoph.grein
2008-05-24 8:00 ` Dmitry A. Kazakov
2008-05-24 12:48 ` Stephen Leake
2008-05-24 14:07 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox