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=0.6 required=5.0 tests=BAYES_00,TO_NO_BRKTS_FROM_MSSP autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7cc62a3e4497b0b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-11 11:56:52 PST Newsgroups: comp.lang.ada From: Ted Dennison References: <%b7V6.4043$pb1.154477@www.newsranger.com> Subject: Re: Q: generic children of generic packages? Message-ID: X-Abuse-Info: When contacting newsranger.com regarding abuse please X-Abuse-Info: forward the entire news article including headers or X-Abuse-Info: else we will not be able to process your request X-Complaints-To: abuse@newsranger.com NNTP-Posting-Date: Mon, 11 Jun 2001 14:55:47 EDT Organization: http://www.newsranger.com Date: Mon, 11 Jun 2001 18:55:47 GMT Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!skynet.be!fu-berlin.de!news.bnb-lp.com!newsranger.com!www.newsranger.com!not-for-mail Xref: archiver1.google.com comp.lang.ada:8570 Date: 2001-06-11T18:55:47+00:00 List-Id: In article , Steve Vestal says... > >Here's what I tried, with the error messages included as comments. The >problem seems to occur in the attempt to instantiate the generic child ..as I guessed. (owch! I think I just wrenched my shoulder patting myself on the back there.) >generic >package Generic_Parent is .. >generic >package Generic_Parent.Generic_Child is So far so good... >package Parent is new Generic_Parent; >-- parent-child.ads:5:35: "Generic_Child" not declared in "Parent" >-- Can also try the following, with following results. >--with Parent.Generic_Child; >-- main.adb:2:06: file "parent-generic_child.ads" not found >package Parent.Child is new Parent.Generic_Child; Three things here. First off, as I said before, you must instantiate from an instance of the generic, not from a generic. You seem to have picked that one up. However, you don't need to "with" something you just declared yourself locally. That's why you are getting an error trying to "with Parent.Generic_Child". Lastly, the new "Child" package that you are creating isn't really a child package once you instantiate it, so you can't give it a parent in the declaration (Think of it as something akin to a "renames" that does some actual work). I haven't compiled this, but you should try: with Generic_Parent.Generic_Child; -- implicitly "with"s Generic_Parent package Parent is new Generic_Parent; package Child is new Parent.Generic_Child; If you don't mind downloading and looking through someone else's code, the example and test directories in OpenToken ( http://www.telepath.com/dennison/Ted/OpenToken/OpenToken.html ) contain quite a few examples of instantiation of generic children of generic packages. Also, any code showing use of the Ada95 Booch Components would contain good examples (but I don't know where any of those are online). --- T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html home email - mailto:dennison@telepath.com