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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, WEIRD_PORT autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7eaf9f2597de2259 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-10 03:28:55 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!fr.usenet-edu.net!usenet-edu.net!enst!enst.fr!not-for-mail From: Francisco Javier Loma Daza Newsgroups: comp.lang.ada Subject: Re: on package naming, should the word "_pkg" be part of it? Date: Wed, 10 Oct 2001 12:27:49 +0200 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: <9pif1o01btl@drn.newsguy.com> <3BBD12F1.9BED0B70@acm.org> <3BC0B1D4.21C79A8@acm.org> <3bc1d137.20930256@news.demon.co.uk> <3bc3ffb5.826258@news.demon.co.uk> <3bc40fef.1827097@news.demon.co.uk> Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Trace: avanie.enst.fr 1002709733 38898 137.194.161.2 (10 Oct 2001 10:28:53 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Wed, 10 Oct 2001 10:28:53 +0000 (UTC) To: comp.lang.ada@ada.eu.org Return-Path: In-Reply-To: <3bc40fef.1827097@news.demon.co.uk> X-Mailer: Spruce 0.7.4 for X11 w/smtpio 0.8.2 X-Virus-Scanned: by AMaViS perl-11 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.4 Precedence: bulk X-Reply-To: Francisco.Loma@isotrol.com List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , List-Archive: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:14137 Date: 2001-10-10T12:27:49+02:00 On Wed, 10 Oct 2001, john.mccabe@emrad.com.nospam (John McCabe) wrote: > Date: Wed, 10 Oct 2001 09:47:04 GMT > To: comp.lang.ada@ada.eu.org > From: john.mccabe@emrad.com.nospam (John McCabe) > Reply-To: comp.lang.ada@ada.eu.org > Sender: comp.lang.ada-admin@ada.eu.org > Subject: Re: on package naming, should the word "_pkg" be part of it? > > On Wed, 10 Oct 2001 08:04:10 GMT, john.mccabe@emrad.com.nospam (John > McCabe) wrote: > > Francisco > > I've just been reminded of where the problem lies with respect to the > use of Object as a 'class' name (with thanks to Martin Ellerker). > > Consider the following Parent and Child classes (similar to what I > mentioned in my earlier message): > > File: GParent.ads > ----------------- > generic > package GParent is > type Object is abstract tagged null record; > end GParent; > > File: GParent-GChild.ads > ------------------------ > with GParent; > generic > package GParent.GChild is > type Object is new GParent.Object with null record; > end GParent.GChild; > > Separate library level instantiations are provided as follows: > > File: IParent.ads > ----------------- > with GParent; > package IParent is new GParent; > > File: IChild.ads > ---------------- > with IParent; > with GParent.GChild; > package IChild is new IParent.GChild; > > So far so good. A test program as follows compiles and runs without > error (unless I've typed something in wrongly) > > File: TestG.adb > --------------- > with IChild; > procedure TestG is > begin > null; > end TestG; > > > Now, however, if you then have a third level of Generic class, say.. > > File: GParent-GChild-GGChild.ads > -------------------------------- > with GParent.GChild; > generic > package GParent.GChild.GGChild is > type Object is new GParent.GChild.Object with null record; > end GParent.GChild.GGChild; > > and instantiate it with: > > File: IGChild.ads > ----------------- > with IChild; > with GParent.GChild.GGChild; > package IGChild is new IChild.GGChild; > > and change the test program to: > > File: TestG.adb > --------------- > with IGChild; -- Change to IGChild from IChild. > procedure TestG is > begin > null; > end TestG; > > we get the error: > > igchild.ads:3:01: instantiation error at gparent-gchild-ggchild.ads:4 > igchild.ads:3:01: "GChild" not declared in "IParent". > > The cause of this is the explicit reference in line 4 of > GParent-GChild-GGChild.ads to GParent.GChild.Object. Since IChild is > the instantiation of GChild, it is IChild that, at this point, > declares the GGChild 'class' we're interested in, not GParent.GChild. > > We could attempt to use the child-to-parent visibility rules to allow > use to change GParent.Object and GParent.GChild.Object into just > Object and Object, but then the scoping rules cause problems with > errors: > > gparent-gchild.ads:4:24: object "Object" cannot be used before end of > its declaration > gparent-gchild-ggchild.ads:4:24: object "Object" cannot be used before > end of its declaration > > So there you go. The problem is not in naming 'Object' the types, but the extra level (innecesary) of qualification for the parent object name GParent.GChild.Object new GChild.Object will work. Escecifying Gparent.G... references to generic (uninstanciated) package. Try to name with different names all the types gParent.Object1 gParent.gChild.Object2 gparent.gChild.ggChild.Object3 and the problem still alive, so the problem is not this naming convention. I'm wrong?