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,59e7405b37921f3e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-20 14:10:42 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: A good way to name instantiated children? Date: 20 Jun 2003 17:06:28 -0400 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1056143209 22299 128.183.235.92 (20 Jun 2003 21:06:49 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 20 Jun 2003 21:06:49 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Xref: archiver1.google.com comp.lang.ada:39508 Date: 2003-06-20T21:06:49+00:00 List-Id: "Dmitry A. Kazakov" writes: > Hi! > > Let we have a chain of generic packages: > > A.B.C.D... > > Let the root A have a generic parameter, say, > > type Number is private; > > Now, I want to instantiate all packages of the chain with Number => Float. > The problem i,s how to name the children? > > package Float_A is new A (Float); > > is fine, but the children cannot be named Float_A.B.C.D: > > with Float_A; > with A.B; > package Float_A.B is new Float_A.B; -- Error > > (generic A.B contaminates the name space of Float_A). > > Float_A.Float_B.Float_C.Float_D looks awful. > > Any ideas? I solve this by prefixing Gen_ to the generic package names: generic type Number is private; package Gen_A is ... generic package Gen_A.Gen_B is ... Then the instantiations can be: with Gen_A; package Float_A is new Gen_A (Float); with Gen_A.Gen_B; package Float_A.B is new Float_A.Gen_B; Yes, the Gen_A.Gen_B.Gen_C.Gen_D is a little ugly. But the instantiation names are nice, which is more important. And it makes it clear from the package name whether the package is generic or not, which is also helpful. -- -- Stephe