From: Georg Bauhaus on 16 Dec 2009 10:54 Andrea Taverna schrieb: > On 16 Dic, 14:14, Georg Bauhaus <rm.dash-bauh...(a)futureapps.de> wrote: >> Andrea Taverna schrieb: >> >>> 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? >> It's not a "use" issue I think. P.F is marked invisible, >> too. > I'm not sure I understand you correctly here, however P.F *is* > visible, in fact the compiler stops complaining after prefixig P's > name to F. My mistake, sorry. (I had forgotton to prefix the other F.) Is the question then whether or not "use" of a generic formal package extends to the formal parameters of the generic formal package (a formal package with a (<>))? My best guess would be to start from Ada 95 12.7(10), if that still applies, but I simply don't know, and I don't have my other compiler handy which might give a more detailed error message.
From: Andrea Taverna on 16 Dec 2009 11:54 On 16 Dic, 16:54, Georg Bauhaus <rm.dash-bauh...(a)futureapps.de> wrote: > Andrea Taverna schrieb: > > > > > On 16 Dic, 14:14, Georg Bauhaus <rm.dash-bauh...(a)futureapps.de> wrote: > >> Andrea Taverna schrieb: > > >>> 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? > >> It's not a "use" issue I think. P.F is marked invisible, > >> too. > > I'm not sure I understand you correctly here, however P.F *is* > > visible, in fact the compiler stops complaining after prefixig P's > > name to F. > > My mistake, sorry. (I had forgotton to prefix the other F.) > > Is the question then whether or not "use" of a generic > formal package extends to the formal parameters of the > generic formal package (a formal package with a (<>))? Hmm... I know that they are already visible in Parent as soon as I add the use-clause. The problem is whether I can "use" the generic formal package in a child of the generic package of which is a parameter.The fact the package itself is visible in every children of such package would suggest that I could. > My best guess would be to start from Ada 95 12.7(10), > if that still applies, but I simply don't know, and I > don't have my other compiler handy which might give a more > detailed error message. Please bear some patience, I'ma self-thaught newbie. http://www.adapower.com/adapower1/rm95/arm95_187.html In Ada95 12.7 there seems not to be anything relevant about such problem. What does the "(10)" mean? thanks Andrea
From: Georg Bauhaus on 16 Dec 2009 13:54 Andrea Taverna schrieb: > On 16 Dic, 16:54, Georg Bauhaus <rm.dash-bauh...(a)futureapps.de> wrote: >> Andrea Taverna schrieb: >> >> >> >>> On 16 Dic, 14:14, Georg Bauhaus <rm.dash-bauh...(a)futureapps.de> wrote: >>>> Andrea Taverna schrieb: >>>>> 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? >>>> It's not a "use" issue I think. P.F is marked invisible, >>>> too. >>> I'm not sure I understand you correctly here, however P.F *is* >>> visible, in fact the compiler stops complaining after prefixig P's >>> name to F. >> My mistake, sorry. (I had forgotton to prefix the other F.) >> >> Is the question then whether or not "use" of a generic >> formal package extends to the formal parameters of the >> generic formal package (a formal package with a (<>))? > > Hmm... I know that they are already visible in Parent as soon as I add > the use-clause. The problem is whether I can "use" the generic formal > package in a child of the generic package of which is a parameter.The > fact the package itself is visible in every children of such package > would suggest that I could. My idea, possibly confused, is that somehow the formal parameter F of generic package Q is not made visible in Parent.Child. With LRM 95 12.7(10) in mind, generic with package P is new Q (<>); ... package Parent... means, I think, that the parameters for which (<>) stands are included in visibility decisions. > http://www.adapower.com/adapower1/rm95/arm95_187.html (The paragraph numbering on that page is a bit different from what is normally used in the RM. (10) means the tenth paragraph which happens to be "Static Semantics, 2nd", on adapower.com) "The visible part of a formal package includes the first list of basic_declarative_items of the package_specification. In addition, if the formal_package_actual_part is (<>), it also includes the generic_formal_part of the template for the formal package." P is the formal package with formal_package_actual_part (<>). Q is the template, F is in Qs generic_format_part. So F should be as visible as anything specified in P. But I'm a layman, hopefully some expert can explain all this.
From: sjw on 16 Dec 2009 16:26 On Dec 16, 4:54 pm, Andrea Taverna <a.t...(a)hotmail.it> wrote: > Please bear some patience, I'ma self-thaught newbie.http://www.adapower.com/adapower1/rm95/arm95_187.html > In Ada95 12.7 there seems not to be anything relevant about such > problem. What does the "(10)" mean? That's not a very good copy of the RM (I don't know where the pages originated). A much better one is at http://www.adaic.com/standards/95lrm/html/RM-12-7.html -- "(10)" means paragraph 10, preceded at the left with a small '10'. I don't recall exactly why you want to 'use P;'? Personally I wouldn't even be tempted to do so; many bad experiences with similar usages! Even discounting compiler errors/bombs, consider: - what happens if there's another F (with the same profile) visible? - what happens if you change P so it no longer has an F (with a matching profile)?
From: Adam Beneschan on 16 Dec 2009 16:27 On Dec 15, 11:28 am, Andrea Taverna <a.t...(a)hotmail.it> wrote: > Hello everyone, > > I have the following packages: > > generic > with package P is new Q (<>); > use 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? It's a bug. The scope of the "use P" is supposed to include Parent.Child (8.1(9), 8.4(7)). -- Adam
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: Shootout News: 64 Bits of Sweet Pancake Next: New ARA sponsorship levels |