comp.lang.ada
 help / color / mirror / Atom feed
From: gauthier@alphainfo.unilim.fr (Michel Gauthier)
Subject: [Technical] Generic child parameterised with instance of parent
Date: 1998/11/25
Date: 1998-11-25T00:00:00+00:00	[thread overview]
Message-ID: <gauthier-2511981816270001@cemrad.unilim.fr> (raw)


Here is the need as I can identify it (possibly not in a right way).

There is a generic unit :
    generic
        type ITEM is private ;
    package G1 is ...

What I have to do is
    generic
        with package GP is new G1 ( <> ) ;
    package G1 . Child is ...
(the child depends logically on two instances of G1).
I know that something like
    generic
        with package GZ is new G1 ( <> ) ;
        with package GP is new G1 ( <> ) ;
    package NotChild is ...
would work, but I need access the private part of GZ.

Since G1 in with... would denote the current instance, I added 
    generic package G1bis renames G1 ;
and adapted
    generic
        with package GP is new G1bis ( <> ) ;
    package G1 . Child is ...
 There are also instances of G1 :
    package P1Some is new G1 ( some_type ) ;
    package P1Other is new G1 ( other_type ) ;

Then can be compiled. But the compiler rejects
    package InstChild is new P1Some . Child ( P1Other ) ;


Now, the questions :
 1 - is it intrinsicly illegal or is my compiler too ancient ?
 2 - how can I work around the problem ?
 3 - is there a known alternate design ?

----------          ----------          ----------          ---------- 
Michel Gauthier / Laboratoire d'informatique
123 avenue Albert Thomas / F-87060 Limoges
telephone +33 5 55 43 69 73
fax +33 5 55 43 69 77
----------          ----------          ----------          ----------
Hein, quoi, quelle annee dix-neuf cent nonante dix ?
What exactly about year nineteen ninety ten ?
----------          ----------          ----------          ----------




             reply	other threads:[~1998-11-25  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-25  0:00 Michel Gauthier [this message]
1998-11-26  0:00 ` [Technical] Generic child parameterised with instance of parent Mats Weber
1998-11-29  0:00   ` Tucker Taft
replies disabled

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