From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4d972ac0c79198a5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-16 17:23:42 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!news-lei1.dfn.de!news-ham1.dfn.de!news.uni-hamburg.de!cs.tu-berlin.de!uni-duisburg.de!not-for-mail From: Georg Bauhaus Newsgroups: comp.lang.ada Subject: Re: Generic child units Date: Sat, 17 May 2003 00:23:41 +0000 (UTC) Organization: GMUGHDU Message-ID: References: <3ec12f93$1@epflnews.epfl.ch> NNTP-Posting-Host: d2-hrz.uni-duisburg.de X-Trace: a1-hrz.uni-duisburg.de 1053131021 27005 134.91.1.15 (17 May 2003 00:23:41 GMT) X-Complaints-To: usenet@news.uni-duisburg.de NNTP-Posting-Date: Sat, 17 May 2003 00:23:41 +0000 (UTC) User-Agent: tin/1.5.8-20010221 ("Blue Water") (UNIX) (HP-UX/B.11.00 (9000/831)) Xref: archiver1.google.com comp.lang.ada:37417 Date: 2003-05-17T00:23:41+00:00 List-Id: Stephen Leake wrote: : Rodrigo Garc?a writes: : :> I need some enlightment in this area... Let us suppose that I have two :> generic packages declared in separate files and one is the parent of :> the other: :> :> generic :> type Elem is private; :> package Parent is :> type Vector is array (Integer range <>) of Elem; :> end Parent; :> :> generic :> package Parent.Child is :> subtype Vector2D is Vector (1 .. 2); :> end Parent.Child; :> :> How can I instantiate the child package : : with Parent.Child; : procedure Foo is : package Par is new Parent (Elem => Integer); : package Chi is new Par.Child; : begin : ... : end Foo; : : Note that the second instantiation is "Par.Child", not "Parent.Child". I find it useful to compare to this variation of the packages, at least it has shed some light (I think :-/) as far as the instantiation sequence is concerned: generic type Elem is private; package Parent is type Vector is array (Integer range <>) of Elem; generic package Child is subtype Vector2D is Vector (1 .. 2); end Child; end Parent; So, elsewhere, you can't have an instance of child without an instance of parent. But you can have an instance of Child in Parent's body. I don't know why, exactely, though. (No wonder that the editors next door tell me that programmers are funny people :-) -- Georg