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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,205d1b0b3133678 X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: Calling generic children from their parent? Date: 1999/06/23 Message-ID: #1/1 X-Deja-AN: 492832244 References: <19990623004221.05877.00000987@ngol05.aol.com> NNTP-Posting-Date: Tue, 22 Jun 1999 23:29:52 PDT Newsgroups: comp.lang.ada Date: 1999-06-23T00:00:00+00:00 List-Id: On 23 Jun 1999 04:42, rcollinson@aol.com (RCollinson) wrote: > I need to use a type in a generic parent body that is located in the > generic child specification. This is a strange way to organize a hierarchy of generic packages. Perhaps we can find a better organization that avoids these problems altogether. > I am having problems instantiating the child in the parent's body. > The type is not recognized unless it is instantiated. Any ideas? How is that different from any other generic? To make an entity provided by a generic available for use, you have to instantiate the generic. foo.bar is a generic, and so to use the types declared there, foo.bar must first be instantiated. > with foo.bar; > package body foo is > My_Var : Foo.Bar.My_Extended_Type; > -- !!! How do I get an instance of this variable > -- !!! that is a type from the generic child??? > -- !!! Is this possible??? > > end foo; You have to instantiate generic package foo.bar. > generic > package foo.bar is > type My_Extended_Type is new My_Type with > record > ... > end record; > ... > end foo.bar; Why does this need to be in a (generic) child of foo? Why can't it go in the public or private region of foo? (There's no technical reason it can't, because foo.bar doesn't import any generic actual parameters.) Move My_Extended_Type to foo, and get rid of foo.bar.