comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <Stephe.Leake@nasa.gov>
Subject: Re: Specialization generic package parameters
Date: Sat, 24 May 2008 08:48:40 -0400
Date: 2008-05-24T08:48:40-04:00	[thread overview]
Message-ID: <ufxs7kguv.fsf@nasa.gov> (raw)
In-Reply-To: 1996bbhvwjxcr$.1s16brw83713g$.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

> 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?
>
Factor out the types and operations currently in the private part of P
into a helper child package P.Ops.

Access those operations from Q:

4. New package

    with P.Ops;
    generic
      type Some_S is new S with private;
    package Q is
    private
        -- Got access to P.Ops, and have specialization
    end P;

How would you do this in some other language?


-- 
-- Stephe



  parent reply	other threads:[~2008-05-24 12:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-23 17:29 Specialization generic package parameters Dmitry A. Kazakov
2008-05-23 20:17 ` christoph.grein
2008-05-24  8:00   ` Dmitry A. Kazakov
2008-05-24 12:48 ` Stephen Leake [this message]
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