comp.lang.ada
 help / color / mirror / Atom feed
* Full view of limited extension?
@ 2016-10-18  6:24 Maciej Sobczak
  2016-10-18  7:22 ` G.B.
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Maciej Sobczak @ 2016-10-18  6:24 UTC (permalink / raw)


Consider file test.ads:

with Ada.Finalization;

package Test is

   type Parent is limited interface;
   
   type Child is limited new Parent with private;
   
private

   type Child is
      new Ada.Finalization.Limited_Controlled
      and Parent with record
      I : Integer;
   end record;

end Test;

The problem is (GNAT 5.4.0):

$ gcc -c test.ads
test.ads:11:04: full view of limited extension must be explicitly limited

The "limited" keyword is already everywhere, there are no more places to put it. :-) Am I missing some dark language corners here?

-- 
Maciej Sobczak * http://www.inspirel.com


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Full view of limited extension?
  2016-10-18  6:24 Full view of limited extension? Maciej Sobczak
@ 2016-10-18  7:22 ` G.B.
  2016-10-18  7:30 ` Vratislav Podzimek
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: G.B. @ 2016-10-18  7:22 UTC (permalink / raw)


On 18.10.16 08:24, Maciej Sobczak wrote:

> The problem is (GNAT 5.4.0):
>
> $ gcc -c test.ads
> test.ads:11:04: full view of limited extension must be explicitly limited
>
> The "limited" keyword is already everywhere, there are no more places to put it. :-) Am I missing some dark language corners here?

I think its is non-limited full views for non-tagged types
only.  You could work around the redundancy in the names,
though...

with Ada.Finalization;

package Test is

    type Parent is limited interface;

    type Child is limited new Parent with private;

private
    subtype Unmovably_Controlled is Ada.Finalization.Limited_Controlled;
    type Child is limited
       new Unmovably_Controlled
       and Parent with record
       I : Integer;
    end record;

end Test;


-- 
"HOTDOGS ARE NOT BOOKMARKS"
Springfield Elementary teaching staff


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Full view of limited extension?
  2016-10-18  6:24 Full view of limited extension? Maciej Sobczak
  2016-10-18  7:22 ` G.B.
@ 2016-10-18  7:30 ` Vratislav Podzimek
  2016-10-18 15:22 ` Tero Koskinen
  2016-10-20  0:40 ` Randy Brukardt
  3 siblings, 0 replies; 10+ messages in thread
From: Vratislav Podzimek @ 2016-10-18  7:30 UTC (permalink / raw)


On Mon, 17 Oct 2016 23:24:44 -0700, Maciej Sobczak wrote:

> Consider file test.ads:
> 
> with Ada.Finalization;
> 
> package Test is
> 
>    type Parent is limited interface;
>    
>    type Child is limited new Parent with private;
>    
> private
> 
>    type Child is
>       new Ada.Finalization.Limited_Controlled and Parent with record I :
>       Integer;
>    end record;
> 
> end Test;
> 
> The problem is (GNAT 5.4.0):
> 
> $ gcc -c test.ads test.ads:11:04: full view of limited extension must be
> explicitly limited
> 
> The "limited" keyword is already everywhere, there are no more places to
> put it. :-) Am I missing some dark language corners here?
I believe you need to put another 'limited' to the private definition of 
the type 'Child' -- i.e. 'type Child is limited...'

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Full view of limited extension?
  2016-10-18  6:24 Full view of limited extension? Maciej Sobczak
  2016-10-18  7:22 ` G.B.
  2016-10-18  7:30 ` Vratislav Podzimek
@ 2016-10-18 15:22 ` Tero Koskinen
  2016-10-20  0:40 ` Randy Brukardt
  3 siblings, 0 replies; 10+ messages in thread
From: Tero Koskinen @ 2016-10-18 15:22 UTC (permalink / raw)


Hi,

18.10.2016, 9.24, Maciej Sobczak wrote:
> Consider file test.ads:
>
> with Ada.Finalization;
>
> package Test is
>
>    type Parent is limited interface;
>
>    type Child is limited new Parent with private;
>
> private
>
>    type Child is
>       new Ada.Finalization.Limited_Controlled
>       and Parent with record
>       I : Integer;
>    end record;
>
> end Test;
>
> The problem is (GNAT 5.4.0):
>
> $ gcc -c test.ads
> test.ads:11:04: full view of limited extension must be explicitly limited
>
> The "limited" keyword is already everywhere, there are no more places to put it. :-) Am I missing some dark language corners here?

This issue has interesting story:

GNAT didn't have the check until about two years ago.

I was testing your code (YAMI) and noticed that Irvine ICCAda
complained about the code, but GNAT accepted it. So, I went
and filed a bug about it to Adacore:
https://groups.google.com/d/msg/comp.lang.ada/y2FvCsze8AI/ptml4ftJy98J

I happily forgot to do the last step:
Report the problem to YAMI author (you), but apparently
you finally found it by yourself! ;)

Yours,
  Tero



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Full view of limited extension?
  2016-10-18  6:24 Full view of limited extension? Maciej Sobczak
                   ` (2 preceding siblings ...)
  2016-10-18 15:22 ` Tero Koskinen
@ 2016-10-20  0:40 ` Randy Brukardt
  2016-10-26 13:36   ` Maciej Sobczak
  3 siblings, 1 reply; 10+ messages in thread
From: Randy Brukardt @ 2016-10-20  0:40 UTC (permalink / raw)


"Maciej Sobczak" <see.my.homepage@gmail.com> wrote in message 
news:121792c4-3f9d-4d89-8ac5-88375ffb1110@googlegroups.com...
> Consider file test.ads:
>
> with Ada.Finalization;
>
> package Test is
>
>   type Parent is limited interface;
>
>   type Child is limited new Parent with private;
>
> private
>
>   type Child is
>      new Ada.Finalization.Limited_Controlled
>      and Parent with record
>      I : Integer;
>   end record;
>
> end Test;
>
> The problem is (GNAT 5.4.0):
>
> $ gcc -c test.ads
> test.ads:11:04: full view of limited extension must be explicitly limited
>
> The "limited" keyword is already everywhere, there are no more places to 
> put it. :-) Am I missing some dark language corners here?

There's clearly one more place to put it, since there existing a type 
definition in the above code that doesn't include the word "limited". :-)

And the error message is clear enough: the full view must be explicitly 
limited. That is, the word "limited" must appear in it.

You probably are in a "dark language corner",  though, given the reason for 
this requirement doesn't come to mind. If you care, I'd spend some time 
reading the rules in 7.3.1 (use the AARM, so you can find the associated AIs 
and their examples).

                                             Randy.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Full view of limited extension?
  2016-10-20  0:40 ` Randy Brukardt
@ 2016-10-26 13:36   ` Maciej Sobczak
  2016-10-26 21:02     ` Randy Brukardt
  0 siblings, 1 reply; 10+ messages in thread
From: Maciej Sobczak @ 2016-10-26 13:36 UTC (permalink / raw)


On Thursday, October 20, 2016 at 2:40:38 AM UTC+2, Randy Brukardt wrote:

> > The "limited" keyword is already everywhere, there are no more places to 
> > put it. :-) Am I missing some dark language corners here?
> 
> There's clearly one more place to put it, since there existing a type 
> definition in the above code that doesn't include the word "limited". :-)

In the full view? Sure. GNAT says:

   "limited" keyword not allowed in private extension

Without it we have:

   full view of limited extension must be explicitly limited

So it's both required and forbidden, at least according to *some* version of GNAT.

I have to admit that I'm a bit tired of this, especially if checking the code against different compiler versions hits additional problems related to gprbuild being or not being available. Every compiler version that I tried has a different opinion on the code that used to compile and work (!) properly in the past.
This statement will not be popular on this group, but I have never had similar problems with C++ - and we are talking about language features that are already at least one decade old. Something went wrong somewhere.

I will keep trying, though.

-- 
Maciej Sobczak * http://www.inspirel.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Full view of limited extension?
  2016-10-26 13:36   ` Maciej Sobczak
@ 2016-10-26 21:02     ` Randy Brukardt
  2016-10-26 21:08       ` Randy Brukardt
  2016-10-29  4:06       ` Coyo T Stormcaller
  0 siblings, 2 replies; 10+ messages in thread
From: Randy Brukardt @ 2016-10-26 21:02 UTC (permalink / raw)


"Maciej Sobczak" <see.my.homepage@gmail.com> wrote in message 
news:5c6388d5-8545-4fa3-9c8c-228850e23028@googlegroups.com...
On Thursday, October 20, 2016 at 2:40:38 AM UTC+2, Randy Brukardt wrote:

>> > The "limited" keyword is already everywhere, there are no more places 
>> > to
>> > put it. :-) Am I missing some dark language corners here?
>>
>> There's clearly one more place to put it, since there existing a type
>> definition in the above code that doesn't include the word "limited". :-)
>
>In the full view? Sure. GNAT says:
>
>   "limited" keyword not allowed in private extension

That seems like a bug. But it seems unlikely. We made an ACATS test for this 
case (B730010) after it was reported, so it's unlikely that GNAT (or any 
current Ada 2005 compiler) would get it wrong. The objective is:

      Check that if the full_type_declaration for a private extension
      includes a derived_type_definition, then the reserved word limited
      shall appear in the full_type_declaration if it also appears in the
      private_extension_declaration.

This is testing RM 7.3(10.1/3), a rule that was added in Ada 2005.

>Without it we have:
>
>   full view of limited extension must be explicitly limited
>
>So it's both required and forbidden, at least according to *some* version 
>of GNAT.

So *some* version of GNAT has a bug? Wow, what a news flash. :-)

>I have to admit that I'm a bit tired of this, especially if checking the 
>code against different
>compiler versions hits additional problems related to gprbuild being or not 
>being available.
>Every compiler version that I tried has a different opinion on the code 
>that used to compile
>and work (!) properly in the past.

Sure, but the code was *never* legal Ada (2005 or later) code. It sometimes 
happens that an Ada compiler accidentally allows illegal Ada code, but once 
the compiler gets fixed, then such code no longer works. That's life, I'm 
afraid. Otherwise, no one could ever fix their compilers.

>This statement will not be popular on this group, but I have never had 
>similar problems with
>C++ - and we are talking about language features that are already at least 
>one decade old.
>Something went wrong somewhere.

Yes, your illegal code. :-) It was someone's attempt to port your code to a 
different Ada compiler (one that properly diagnosed the illegality) that 
caused (a) the ACATS test to be created, and (b) GNAT to be fixed [in some 
order].

The other thing that was wrong (IMHO) was that the ACATS was neglected 
during the Ada 2005 cycle, and many of these corner cases were not tested. 
Thus an error of omission (forgetting to enforce an error) can easily slip 
through. (I believe the #1 value of the ACATS is detecting errors of 
omission, since no other technique is very good at finding them. That way I 
find it so important that every Legality Rule in the Standard has an 
associated test - we're a long way from achieving that. And of course why 
ACATS B-Tests are so important, because without them the sort of portability 
problem you ran into would be much more prevalent.)

>I will keep trying, though.

Just remember that you've made Ada compilers better (and more consistent) by 
making this mistake. If you hadn't written that illegal code, it's likely 
that to omission in GNAT wouldn't have been detected for a number of more 
years. And it's the nature of this sort of bug that whomever detects it is 
going to be screwed. (We once had a similar sort of bug in Janus/Ada, where 
it wasn't necessary to "with System" before using it. Once we fixed the 
problem, we had recurring problems with previously working code failing to 
compile, requiring a detour to check out/fix/check in the unrelated but 
broken code before continuing.) It's unfortunate that you were the one who 
got the shaft here, but someone was going to get it sooner or later.

>Maciej Sobczak * http://www.inspirel.com

Randy Brukardt.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Full view of limited extension?
  2016-10-26 21:02     ` Randy Brukardt
@ 2016-10-26 21:08       ` Randy Brukardt
  2016-10-27  7:56         ` Maciej Sobczak
  2016-10-29  4:06       ` Coyo T Stormcaller
  1 sibling, 1 reply; 10+ messages in thread
From: Randy Brukardt @ 2016-10-26 21:08 UTC (permalink / raw)


"Randy Brukardt" <randy@rrsoftware.com> wrote in message 
news:nur5ki$epv$1@franka.jacob-sparre.dk...
> "Maciej Sobczak" <see.my.homepage@gmail.com> wrote in message 
> news:5c6388d5-8545-4fa3-9c8c-228850e23028@googlegroups.com...
...
>>So it's both required and forbidden, at least according to *some* version 
>>of GNAT.
>
> So *some* version of GNAT has a bug? Wow, what a news flash. :-)

BTW, GNAT Pro 7.4.1 compiles the following correct code without errors:

with Ada.Finalization;

package Test is

   type Parent is limited interface;

   type Child is limited new Parent with private;

private

   type Child is
      limited new Ada.Finalization.Limited_Controlled
      and Parent with record
      I : Integer;
   end record;

end Test;




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Full view of limited extension?
  2016-10-26 21:08       ` Randy Brukardt
@ 2016-10-27  7:56         ` Maciej Sobczak
  0 siblings, 0 replies; 10+ messages in thread
From: Maciej Sobczak @ 2016-10-27  7:56 UTC (permalink / raw)


On Wednesday, October 26, 2016 at 11:08:03 PM UTC+2, Randy Brukardt wrote:

> >>So it's both required and forbidden,

Sorry for confusion - actually, the syntax that you proposed is accepted by my compiler (5.4.0) and seems to work. There are so many keywords involved in the complete type definition that the proper sequencing matters. :-)

Thank you for the hints. I will confirm the fix with the other compiler versions that I have access to.

-- 
Maciej Sobczak * http://www.inspirel.com


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Full view of limited extension?
  2016-10-26 21:02     ` Randy Brukardt
  2016-10-26 21:08       ` Randy Brukardt
@ 2016-10-29  4:06       ` Coyo T Stormcaller
  1 sibling, 0 replies; 10+ messages in thread
From: Coyo T Stormcaller @ 2016-10-29  4:06 UTC (permalink / raw)


Randy Brukardt wrote:

>>This statement will not be popular on this group, but I have never had
>>similar problems with
>>C++ - and we are talking about language features that are already at least
>>one decade old.
>>Something went wrong somewhere.
> 
> Yes, your illegal code. :-) It was someone's attempt to port your code to
> a different Ada compiler (one that properly diagnosed the illegality) that
> caused (a) the ACATS test to be created, and (b) GNAT to be fixed [in some
> order].

I am among giants.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-10-29  4:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-18  6:24 Full view of limited extension? Maciej Sobczak
2016-10-18  7:22 ` G.B.
2016-10-18  7:30 ` Vratislav Podzimek
2016-10-18 15:22 ` Tero Koskinen
2016-10-20  0:40 ` Randy Brukardt
2016-10-26 13:36   ` Maciej Sobczak
2016-10-26 21:02     ` Randy Brukardt
2016-10-26 21:08       ` Randy Brukardt
2016-10-27  7:56         ` Maciej Sobczak
2016-10-29  4:06       ` Coyo T Stormcaller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox