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,WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,94d84e4971c0caee X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news2.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!oleane.net!oleane!hunter.axlog.fr!nobody From: Jean-Pierre Rosen Newsgroups: comp.lang.ada Subject: Re: Inheritance with Ada types Date: Tue, 09 Feb 2010 10:11:10 +0100 Organization: Adalog Message-ID: References: <92c90b37-0e9b-49f4-ab37-fbd256ed6f06@k41g2000yqm.googlegroups.com> NNTP-Posting-Host: mailhost.axlog.fr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: s1.news.oleane.net 1265709290 30976 195.25.228.57 (9 Feb 2010 09:54:50 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Tue, 9 Feb 2010 09:54:50 +0000 (UTC) User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) In-Reply-To: <92c90b37-0e9b-49f4-ab37-fbd256ed6f06@k41g2000yqm.googlegroups.com> Xref: g2news1.google.com comp.lang.ada:9023 Date: 2010-02-09T10:11:10+01:00 List-Id: Hibou57 (Yannick Duch�ne) a �crit : > On 9 f�v, 03:16, Bryan wrote: > Oops : package and type name share the same name and you there are use > clause... the use clause is particularly evil here. Why? The use clause has no effect in this case! >> $ gnatmake -c parent derived.ads >> gcc -c derived.ads >> derived.ads:3:23: subtype mark required in this context >> derived.ads:3:23: found "Parent" declared at parent.ads:2 > The message refer to >> package Parent is > >> derived.ads:5:23: subtype mark required in this context >> derived.ads:5:23: found "Parent" declared at parent.ads:2 > The same as above > > Either rename your packages (like Parents and Deriveds ... although > the latter is not correct English) or use the convention of giving the class name to the package, and some fixed name like "object" or "instance" to the type. Full rationale for this notation is available in my paper "A naming convention for classes in Ada 9X", downloadable from http://www.adalog.fr/publica2.htm > or drop the use clause and refer to > your Parent ancestor as Parent.Parent instead. Of course, you don't need to drop the use clause to write Parent.Parent! I don't understand why people think that as soon as you have a use clause, you cannot use full names. If within the scope of a use clause you don't get what you want, or if you find that in some cases full names are more readable, by all mean, use full notation! -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr