Talk About Network

Google





Programming > Ada > Specialization ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 5715 of 6006
Post > Topic >>

Specialization generic package parameters

by "Dmitry A. Kazakov" <mailbox@[EMAIL PROTECTED] > May 23, 2008 at 07:29 PM

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
 




 5 Posts in Topic:
Specialization generic package parameters
"Dmitry A. Kazakov&q  2008-05-23 19:29:49 
Re: Specialization generic package parameters
christoph.grein@[EMAIL PR  2008-05-23 13:17:02 
Re: Specialization generic package parameters
"Dmitry A. Kazakov&q  2008-05-24 10:00:52 
Re: Specialization generic package parameters
Stephen Leake <Stephe.  2008-05-24 08:48:40 
Re: Specialization generic package parameters
"Dmitry A. Kazakov&q  2008-05-24 16:07:16 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 14:50:16 PST 2009.