comp.lang.ada
 help / color / mirror / Atom feed
* Aspect CPU
@ 2014-01-15  1:56 Anh Vo
  2014-01-15  7:06 ` Egil H H
  0 siblings, 1 reply; 8+ messages in thread
From: Anh Vo @ 2014-01-15  1:56 UTC (permalink / raw)


task type Workers (Cpu_N : Cpu_Range)
      with Cpu => Cpu_N;

---------------------------------------------
task type Rejected_Workers (Cpu_N : Cpu_Range) is
         entry Start;
      with Cpu => Cpu_N;


I am wandering why the second task declaration is rejected during compilation. Paragraph D.16 does not prohibit this kind of declaration. Could some one point me to the right paragraph where this declaration is not allowed. Thanks.

A. Vo 


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

* Re: Aspect CPU
  2014-01-15  1:56 Aspect CPU Anh Vo
@ 2014-01-15  7:06 ` Egil H H
  2014-01-15 16:54   ` Anh Vo
  0 siblings, 1 reply; 8+ messages in thread
From: Egil H H @ 2014-01-15  7:06 UTC (permalink / raw)


On Wednesday, January 15, 2014 2:56:36 AM UTC+1, Anh Vo wrote:
> 
> task type Rejected_Workers (Cpu_N : Cpu_Range) is
> 
>          entry Start;
> 
>       with Cpu => Cpu_N;

For tasks, the aspect definition comes before the task entries. Try this:

task type Rejected_Workers (Cpu_N : Cpu_Range)
   with Cpu => Cpu_N
is
   entry Start;
end Rejected_Workers;
 
-- 
~egilhh

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

* Re: Aspect CPU
  2014-01-15  7:06 ` Egil H H
@ 2014-01-15 16:54   ` Anh Vo
  2014-01-15 20:00     ` Simon Wright
  0 siblings, 1 reply; 8+ messages in thread
From: Anh Vo @ 2014-01-15 16:54 UTC (permalink / raw)


On Tuesday, January 14, 2014 11:06:57 PM UTC-8, Egil H H wrote:
> On Wednesday, January 15, 2014 2:56:36 AM UTC+1, Anh Vo wrote:
>  
> > task type Rejected_Workers (Cpu_N : Cpu_Range) is 
> >          entry Start;  
> >       with Cpu => Cpu_N; 
> 
> For tasks, the aspect definition comes before the task entries. Try this:
>  
> task type Rejected_Workers (Cpu_N : Cpu_Range)
>    with Cpu => Cpu_N 
> is 
>    entry Start; 
> end Rejected_Workers;

Great! Thank you very much. By the way, do you mind to tell which section of RM showing this declarative syntax.

A. Vo 




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

* Re: Aspect CPU
  2014-01-15 16:54   ` Anh Vo
@ 2014-01-15 20:00     ` Simon Wright
  2014-01-15 20:18       ` J-P. Rosen
  2014-01-15 22:04       ` Anh Vo
  0 siblings, 2 replies; 8+ messages in thread
From: Simon Wright @ 2014-01-15 20:00 UTC (permalink / raw)


Anh Vo <anhvofrcaus@gmail.com> writes:

> By the way, do you mind to tell which
> section of RM showing this declarative syntax.

For tasks, 9.1(2),
http://www.ada-auth.org/standards/12rm/html/RM-9-1.html#p2

There doesn't seem to be an overarching rule for aspect syntax. You
might have thought that the aspects would always come before the 'is',
perhaps, but not so: see 3.2.1(3),
http://www.ada-auth.org/standards/12rm/html/RM-3-2-1.html#p3

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

* Re: Aspect CPU
  2014-01-15 20:00     ` Simon Wright
@ 2014-01-15 20:18       ` J-P. Rosen
  2014-01-15 22:10         ` Anh Vo
  2014-01-15 22:04       ` Anh Vo
  1 sibling, 1 reply; 8+ messages in thread
From: J-P. Rosen @ 2014-01-15 20:18 UTC (permalink / raw)


Le 15/01/2014 21:00, Simon Wright a écrit :
> Anh Vo <anhvofrcaus@gmail.com> writes:
> 
>> By the way, do you mind to tell which
>> section of RM showing this declarative syntax.
> 
> For tasks, 9.1(2),
> http://www.ada-auth.org/standards/12rm/html/RM-9-1.html#p2
> 
> There doesn't seem to be an overarching rule for aspect syntax. You
> might have thought that the aspects would always come before the 'is',
> perhaps, but not so: see 3.2.1(3),
> http://www.ada-auth.org/standards/12rm/html/RM-3-2-1.html#p3
> 
Yeap, normally the aspect should go after the type definition, but in
the case of a task type, it was felt that it would put them too far
away, at a place where nobody would see it.

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr

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

* Re: Aspect CPU
  2014-01-15 20:00     ` Simon Wright
  2014-01-15 20:18       ` J-P. Rosen
@ 2014-01-15 22:04       ` Anh Vo
  2014-01-15 23:25         ` Randy Brukardt
  1 sibling, 1 reply; 8+ messages in thread
From: Anh Vo @ 2014-01-15 22:04 UTC (permalink / raw)


On Wednesday, January 15, 2014 12:00:26 PM UTC-8, Simon Wright wrote:
> Anh Vo <anhvofrcaus@gmail.com> writes:
>  
> > By the way, do you mind to tell which
> > section of RM showing this declarative syntax.
>  
> For tasks, 9.1(2),
> http://www.ada-auth.org/standards/12rm/html/RM-9-1.html#p2
 
Thanks Simon. It is obviously I overlooked this section. After looking at this section carefully, paragraph 6/3 invokes my curiosity. My question is why aspect_specification is allowed in task body definition as paragraph 6/3 is repeated below for easy discussion.

task_body ::= 
   task body defining_identifier
        [aspect_specification] is
     declarative_part
   begin
     handled_sequence_of_statements
   end [task_identifier];

Anh Vo


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

* Re: Aspect CPU
  2014-01-15 20:18       ` J-P. Rosen
@ 2014-01-15 22:10         ` Anh Vo
  0 siblings, 0 replies; 8+ messages in thread
From: Anh Vo @ 2014-01-15 22:10 UTC (permalink / raw)


On Wednesday, January 15, 2014 12:18:34 PM UTC-8, J-P. Rosen wrote:
> Le 15/01/2014 21:00, Simon Wright a �crit :
> 
> > Anh Vo <anhvofrcaus@gmail.com> writes: 
> >> By the way, do you mind to tell which
> >> section of RM showing this declarative syntax.
>   
> Yeap, normally the aspect should go after the type definition, but in 
> the case of a task type, it was felt that it would put them too far 
> away, at a place where nobody would see it.
 
It is good to know the rationale behind it. Thank you for pointing it out.

A. Vo


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

* Re: Aspect CPU
  2014-01-15 22:04       ` Anh Vo
@ 2014-01-15 23:25         ` Randy Brukardt
  0 siblings, 0 replies; 8+ messages in thread
From: Randy Brukardt @ 2014-01-15 23:25 UTC (permalink / raw)


"Anh Vo" <anhvofrcaus@gmail.com> wrote in message 
news:9e8a283e-997a-4409-ab3e-fe14a0904066@googlegroups.com...
On Wednesday, January 15, 2014 12:00:26 PM UTC-8, Simon Wright wrote:
...
>Thanks Simon. It is obviously I overlooked this section. After looking at 
>this section carefully,
>paragraph 6/3 invokes my curiosity. My question is why aspect_specification 
>is allowed in
>task body definition as paragraph 6/3 is repeated below for easy 
>discussion.

The Language Design Principles at the start of subclause 13.1.1 of the AARM 
goes into the reasons for the syntax of aspect specifications. We argued 
about this a lot, and it became pretty clear that there was no perfect 
solution.

The short answer is that virtually all kinds of (stand-alone) declarations 
allow aspect specifications, and that includes all kinds of bodies. 
13.1.1(17/3) notes that there many kinds of declarations that allow aspect 
specifications, but have no language-defined aspects that can be specified 
there. The primary reason for this is so that implementation-defined aspects 
(and possible further language-defined aspects) can be placed there if that 
makes sense. The AARM notes that an implementation will have to make up 
rules for such aspects, as the language doesn't provide any.

                              Randy.



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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-15  1:56 Aspect CPU Anh Vo
2014-01-15  7:06 ` Egil H H
2014-01-15 16:54   ` Anh Vo
2014-01-15 20:00     ` Simon Wright
2014-01-15 20:18       ` J-P. Rosen
2014-01-15 22:10         ` Anh Vo
2014-01-15 22:04       ` Anh Vo
2014-01-15 23:25         ` Randy Brukardt

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