comp.lang.ada
 help / color / mirror / Atom feed
* Freezing query
@ 2014-01-30 21:49 Simon Wright
  2014-01-30 23:23 ` adambeneschan
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Wright @ 2014-01-30 21:49 UTC (permalink / raw)


A question[1] on StackOverflow thinks that given

   type U is tagged private;
   type W is new U with private;
   type X is new W with private;

   procedure M1 (P1 : U; P2 : in out U; P3 : Integer);
   procedure M2 (P1 : Float ; P2 : in out U);
   procedure M2 (P1 : Float ; P2 : Boolean ; P3 : in out W);

the three operations are primitive.

GNAT doesn't treat them as primitive unless you re-order so that the
subprograms come immediately after the type concerned:

   type U is tagged private;
   procedure M1 (P1 : U; P2 : in out U; P3 : Integer);
   procedure M2 (P1 : Float ; P2 : in out U);

   type W is new U with private;
   procedure M2 (P1 : Float ; P2 : Boolean ; P3 : in out W);

   type X is new W with private;

This seems reasonable given ARM 13.14(7)[2], but then AARM 13.14(7.b)[3]
says that "The declaration of a private extension does not cause
freezing.".

You'd have thought that (7.b) ought not to be relegated to the Annotated
manual!

Is GNAT's behaviour a bug?

[1]
http://stackoverflow.com/questions/21447636/ada-derived-types-and-primitive-operation
[2] http://www.ada-auth.org/standards/12rm/html/RM-13-14.html#p7
[3] http://www.ada-auth.org/standards/12aarm/html/AA-13-14.html#p7.b


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

* Re: Freezing query
  2014-01-30 21:49 Freezing query Simon Wright
@ 2014-01-30 23:23 ` adambeneschan
  2014-01-31  0:20   ` Simon Wright
  0 siblings, 1 reply; 4+ messages in thread
From: adambeneschan @ 2014-01-30 23:23 UTC (permalink / raw)


On Thursday, January 30, 2014 1:49:26 PM UTC-8, Simon Wright wrote:
> A question[1] on StackOverflow thinks that given

>    type U is tagged private;
>    type W is new U with private;
>    type X is new W with private;
> 
>    procedure M1 (P1 : U; P2 : in out U; P3 : Integer);
>    procedure M2 (P1 : Float ; P2 : in out U);
>    procedure M2 (P1 : Float ; P2 : Boolean ; P3 : in out W);
> 
> the three operations are primitive.
> 
> GNAT doesn't treat them as primitive unless you re-order so that the
> subprograms come immediately after the type concerned:

Have you seen the latest comment on the SO page?  Does it address your question?

                        -- Adam


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

* Re: Freezing query
  2014-01-30 23:23 ` adambeneschan
@ 2014-01-31  0:20   ` Simon Wright
  2014-01-31 23:02     ` Randy Brukardt
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Wright @ 2014-01-31  0:20 UTC (permalink / raw)


adambeneschan@gmail.com writes:

> On Thursday, January 30, 2014 1:49:26 PM UTC-8, Simon Wright wrote:
>> A question[1] on StackOverflow thinks that given
>
>>    type U is tagged private;
>>    type W is new U with private;
>>    type X is new W with private;
>> 
>>    procedure M1 (P1 : U; P2 : in out U; P3 : Integer);
>>    procedure M2 (P1 : Float ; P2 : in out U);
>>    procedure M2 (P1 : Float ; P2 : Boolean ; P3 : in out W);
>> 
>> the three operations are primitive.
>> 
>> GNAT doesn't treat them as primitive unless you re-order so that the
>> subprograms come immediately after the type concerned:
>
> Have you seen the latest comment on the SO page?  Does it address your
> question?

The very latest comment does address the question. And I was wrong (but
still puzzled by the apparent conflict between 13.14(7) and (7.b): is it
the case that

   type W is new U with private;

is not a record extension? I guess that's it).

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

* Re: Freezing query
  2014-01-31  0:20   ` Simon Wright
@ 2014-01-31 23:02     ` Randy Brukardt
  0 siblings, 0 replies; 4+ messages in thread
From: Randy Brukardt @ 2014-01-31 23:02 UTC (permalink / raw)


"Simon Wright" <simon@pushface.org> wrote in message 
news:lylhxx2e9f.fsf@pushface.org...
> adambeneschan@gmail.com writes:
...
> The very latest comment does address the question. And I was wrong (but
> still puzzled by the apparent conflict between 13.14(7) and (7.b): is it
> the case that
>
>   type W is new U with private;
>
> is not a record extension? I guess that's it).

Yes, that's it. That's why 7.b is a Ramification - it's "obvious" from other 
rules, but the AARM mentions it because a causal reader might have the wrong 
impression. As in this case! :-)

                                     Randy.


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

end of thread, other threads:[~2014-01-31 23:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-30 21:49 Freezing query Simon Wright
2014-01-30 23:23 ` adambeneschan
2014-01-31  0:20   ` Simon Wright
2014-01-31 23:02     ` Randy Brukardt

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