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,8e396f80f7d741d0 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-02-28 12:35:37 PST Newsgroups: comp.lang.ada Path: nntp.gmd.de!stern.fokus.gmd.de!ceres.fokus.gmd.de!zib-berlin.de!fauern!news.th-darmstadt.de!terra.wiwi.uni-frankfurt.de!zeus.rbi.informatik.uni-frankfurt.de!news.dfn.de!fu-berlin.de!zrz.TU-Berlin.DE!netmbx.de!unlisys!news.maz.net!pipex!howland.reston.ans.net!math.ohio-state.edu!uwm.edu!lll-winken.llnl.gov!noc.near.net!inmet!henning!stt From: stt@henning.camb.inmet.com (Tucker Taft) Subject: Re: Use of generic child formal package Message-ID: Sender: news@inmet.camb.inmet.com Organization: Intermetrics, Inc. X-Newsreader: TIN [version 1.1 PL8] References: Date: Tue, 28 Feb 1995 20:35:37 GMT Date: 1995-02-28T20:35:37+00:00 List-Id: Ed Falis (falis@east.alsys.com) wrote: : I'd like to provide an instance of a generic child unit as a formal package : actual parameter to another generic. To wit: : generic : -- parent's formals : package parent is ... ; end parent; : generic : -- child's formals : package parent.child is ...; end parent.child; : with parent; : generic : -- client formals : package client is : package parent_instance is new parent(...); : end client; : -- Here's the hitch: : with parent.child; : generic : -- ??: : with parent_instance.child is new parent.child (...); : package client.child is ...; : Gnat 2.02 doesn't like the syntax for the formal package parameter: the selected : name notation is rejected. I've tried a few other ways of declaring the formal : package, without success. : So, is it legal, or is it GNAT? The rules for children of generic packages changed in the final months before the standard was released. I don't know whether GNAT has implemented the final semantics. However, your usage above is not correct. With the final formulation for children of generics, the effect of a with clause for a child of a generic is to make a corresponding generic subpackage of the same name appear in every instance of the parent. In other words, when you mention a child of a generic in a with clause, it is as though the parent unit had *always* included the child as a generic subpackage, so that any instances of the parent would hence include a corresponding generic subpackage. Given the above rules, what you should write (though no guarantees that GNAT will understand it yet): with Parent.Child; generic with package Child_Instance is new Client.Parent_Instance.Child(<>); package Client.Child is ... : What I'm trying to do is to use multiple child units for distinct generic : implementations of generic component, binding the implementation at the : time of instantiating client.child, which will present an interface to its : own clients. : - Ed -Tucker Taft stt@inmet.com Intermetrics, Inc.