* "use" after "limited with" (GNAT bug?)
@ 2014-08-14 18:08 Victor Porton
2014-08-14 18:37 ` Adam Beneschan
0 siblings, 1 reply; 4+ messages in thread
From: Victor Porton @ 2014-08-14 18:08 UTC (permalink / raw)
-- p1.ads
package P1 is
end P1;
-- p2.ads
limited with P1;
use P1;
package P2 is
end P2;
$ gnatmake -q -c -gnatc -u -P/home/porton/t/p/default.gpr p2.ads
p2.ads:2:05: "P1" is undefined
gnatmake: "/home/porton/t/p/p2.ads" compilation error
Why "use" does not work? Is it a bug of gnatgcc (Debian 4.9.1-4) 4.9.1?
--
Victor Porton - http://portonvictor.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: "use" after "limited with" (GNAT bug?)
2014-08-14 18:08 "use" after "limited with" (GNAT bug?) Victor Porton
@ 2014-08-14 18:37 ` Adam Beneschan
2014-08-14 18:41 ` Victor Porton
0 siblings, 1 reply; 4+ messages in thread
From: Adam Beneschan @ 2014-08-14 18:37 UTC (permalink / raw)
On Thursday, August 14, 2014 11:08:47 AM UTC-7, Victor Porton wrote:
> -- p1.ads
>
> package P1 is
>
> end P1;
>
> -- p2.ads
>
> limited with P1;
> use P1;
>
> package P2 is
>
> end P2;
>
>
>
> $ gnatmake -q -c -gnatc -u -P/home/porton/t/p/default.gpr p2.ads
> p2.ads:2:05: "P1" is undefined
> gnatmake: "/home/porton/t/p/p2.ads" compilation error
>
> Why "use" does not work? Is it a bug of gnatgcc (Debian 4.9.1-4) 4.9.1?
It's illegal. You just can't USE a LIMITED WITH'ed package.
RM 10.1.2, paragraphs 19, 22:
A limited_with_clause that names a library package shall not appear:
within a context_clause for a library_item that is within the scope of a use_clause that names an entity declared within the declarative region of the library package.
From the AARM:
Reason: This prevents visibility issues, where whether an entity is an incomplete or full view depends on how the name of the entity is written. The limited_with_clause cannot be useful, as we must have the full view available in the parent in order for the use_clause to be legal.
-- Adam
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: "use" after "limited with" (GNAT bug?)
2014-08-14 18:37 ` Adam Beneschan
@ 2014-08-14 18:41 ` Victor Porton
2014-08-15 0:52 ` Shark8
0 siblings, 1 reply; 4+ messages in thread
From: Victor Porton @ 2014-08-14 18:41 UTC (permalink / raw)
Adam Beneschan wrote:
> On Thursday, August 14, 2014 11:08:47 AM UTC-7, Victor Porton wrote:
>> -- p1.ads
>>
>> package P1 is
>>
>> end P1;
>>
>> -- p2.ads
>>
>> limited with P1;
>> use P1;
>>
>> package P2 is
>>
>> end P2;
>>
>>
>>
>> $ gnatmake -q -c -gnatc -u -P/home/porton/t/p/default.gpr p2.ads
>> p2.ads:2:05: "P1" is undefined
>> gnatmake: "/home/porton/t/p/p2.ads" compilation error
>>
>> Why "use" does not work? Is it a bug of gnatgcc (Debian 4.9.1-4) 4.9.1?
>
> It's illegal. You just can't USE a LIMITED WITH'ed package.
>
> RM 10.1.2, paragraphs 19, 22:
>
> A limited_with_clause that names a library package shall not appear:
>
> within a context_clause for a library_item that is within the scope of a
> use_clause that names an entity declared within the declarative region of
> the library package.
>
> From the AARM:
>
> Reason: This prevents visibility issues, where whether an entity is an
> incomplete or full view depends on how the name of the entity is written.
> The limited_with_clause cannot be useful, as we must have the full view
> available in the parent in order for the use_clause to be legal.
Not a language lawyer, but may be it makes sense to introduced "limited use"
clauses?
--
Victor Porton - http://portonvictor.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: "use" after "limited with" (GNAT bug?)
2014-08-14 18:41 ` Victor Porton
@ 2014-08-15 0:52 ` Shark8
0 siblings, 0 replies; 4+ messages in thread
From: Shark8 @ 2014-08-15 0:52 UTC (permalink / raw)
On 14-Aug-14 12:41, Victor Porton wrote:
> Not a language lawyer, but may be it makes sense to introduced "limited use"
> clauses?
How would it work?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-08-15 0:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-14 18:08 "use" after "limited with" (GNAT bug?) Victor Porton
2014-08-14 18:37 ` Adam Beneschan
2014-08-14 18:41 ` Victor Porton
2014-08-15 0:52 ` Shark8
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox