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,FREEMAIL_FROM, WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,12eefe849df97d15 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!o19g2000vbj.googlegroups.com!not-for-mail From: Andrea Taverna Newsgroups: comp.lang.ada Subject: Re: Visibility of package parameters in child packages Date: Wed, 16 Dec 2009 03:50:12 -0800 (PST) Organization: http://groups.google.com Message-ID: <02e4d172-0eb9-4c2a-ac0f-68e151916d59@o19g2000vbj.googlegroups.com> References: <4b27f8e9$0$6591$9b4e6d93@newsspool3.arcor-online.net> NNTP-Posting-Host: 151.47.214.121 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1260964212 14582 127.0.0.1 (16 Dec 2009 11:50:12 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 16 Dec 2009 11:50:12 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o19g2000vbj.googlegroups.com; posting-host=151.47.214.121; posting-account=q_H03goAAABDwevycEkYzGRVjq5lpBVA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:8397 Date: 2009-12-16T03:50:12-08:00 List-Id: On 15 Dic, 22:00, Georg Bauhaus wrote: > Andrea Taverna schrieb: > > > > > generic > > =A0 =A0with package P is new Q (<>); > > =A0 =A0use P; > > package Parent is > > ... > > end Parent; > > > generic > > Parent.Child is > > ... > > end Parent.Child; > > > I can see P declarations inside Parent, but in Child I need to prefix > > everything with 'P.', even if I add a use-clause. > > This happens with gnat-4.3.0 . > > Is it normal? How can I "use" P inside Child? > > generic > Parent.Child is > =A0 use P; > end Parent.Child; I compiled the following -----%<-----%<-----%<-----%<-----%< -- SIGNATURE PACKAGE generic type T is private; with function F(X : T) return T; package Q is end Q; -- PARENT with Q; with Ada.Text_IO; generic with package P is new Q(<>); use P; package Parent is procedure A (X : T); end Parent; package body Parent is procedure A (X : T) is C : T :=3D F(X); begin Ada.Text_IO("Hello"); end A; end Parent; -- CHILD generic package Parent.Child is use P; function B(X : T) return T; end Parent.Child; package body Parent.Child is function B(X : T) return T is use P; D : T :=3D F(X); begin return F(D); end B; end Parent.Child; -- INSTANTIATION with Parent.Child; with Q; procedure Main is function Incf(X : Integer) return Integer is begin return X + 1; end Incf; package R is new Q(Integer, Incf); package Par is new Parent(R); package Ch is new Par.Child; begin null; end Main; -----%<-----%<-----%<-----%<-----%< and the compiler replied -----%<-----%<-----%<-----%<-----%< ]# gnatmake main.adb gcc -c main.adb main.adb:9:05: instantiation error at parent-child.adb:6 main.adb:9:05: "F" is not visible (more references follow) main.adb:9:05: instantiation error at parent-child.adb:6 main.adb:9:05: non-visible declaration at q.ads:3 gnatmake: "main.adb" compilation error -----%<-----%<-----%<-----%<-----%< Am I missing something?