comp.lang.ada
 help / color / mirror / Atom feed
From: "Phil Slater" <phil.slater@amsjv.com>
Subject: Re: Task discriminants
Date: Fri, 21 May 2004 10:43:32 +0100
Date: 2004-05-21T10:43:32+01:00	[thread overview]
Message-ID: <40adcdfe_1@baen1673807.greenlnk.net> (raw)
In-Reply-To: c8itt3$gkq$1@titan.btinternet.com

This prompts the question, "are tasks on an array elaborated in order from
low-index to high-index? So is Martin's code below guaranteed to make each
task's discriminant the same as its index on the array? I looked in RM95 but
couldn't locate order of elaboration of array elements.

If so, it's potentially useful for setting up an array of tasks that passes
data up and down the array by each rendezvousing with its neighbours.
(Obviously the start value of Id and the index range of the array have to be
consistent.)

But if the order of elaboration isn't guaranteed, we're back to the old
"roll-call" initialisation rendezvous again.



"Martin Dowie" <martin.dowie@btopenworld.com> wrote in message
news:c8itt3$gkq$1@titan.btinternet.com...
> function Next_Id return Integer;
>
> task type A_Task (Id : Integer := Next_Id);
>
> Id : Integer := 0;
>
> function Next_Id return Integer is
> begin
>    Id := Id + 1;
>    return Id;
> end Next_Id;
>
> The_Tasks : array (1 .. 3) of A_Task;
>
> You could consider putting Id and Next_Id in their own package.
>
> Cheers
>
> -- Martin
>
>
> "David C. Hoos" <david.c.hoos.sr@ada95.com> wrote in message
> news:mailman.1.1085073466.401.comp.lang.ada@ada-france.org...
> > How about:
> >
> > The_Tasks: array (1 .. 3) of A_Task =
> >  (A_Task (1),
> >   A_Task (2),
> >   A_Task (3)
> >  );
> > ----- Original Message -----
> > From: "Dave Levy" <dlevy@mail.usyd.edu.au>
> > Newsgroups: comp.lang.ada
> > To: <comp.lang.ada@ada-france.org>
> > Sent: Thursday, May 20, 2004 9:47 AM
> > Subject: Task discriminants
> >
> >
> > > Hi
> > >
> > > Suppose one has a task type with a discriminant:
> > >
> > >     task type A_Task( Id : integer);
> > >
> > > and one wishes to declare a set of tasks with initialised
discriminants:
> > >     t1 : A_Task(1);
> > >     t2 : A_Task(2);
> > >     t3 : A_Task(3);
> > >
> > > How could one declare them as an array of tasks with each one getting
an
> > > initialised discriminant? Perhaps something like:
> > >
> > >     The_Tasks: array (1..3) of A_Task( Id => 1,2,3 );
> > >
> > > Except I tried this with Gnat and it won't compile.
> > >
> > > Thanks
> > >
> > > Dave
> > >
> > > _______________________________________________
> > > comp.lang.ada mailing list
> > > comp.lang.ada@ada-france.org
> > > http://www.ada-france.org/mailman/listinfo/comp.lang.ada
> > >
>
>





  parent reply	other threads:[~2004-05-21  9:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-20 14:47 Task discriminants Dave Levy
2004-05-20 17:17 ` David C. Hoos
2004-05-20 18:37   ` Martin Dowie
2004-05-21  0:39     ` Georg Bauhaus
2004-05-21  1:04       ` Jeffrey Carter
2004-05-21  9:43     ` Phil Slater [this message]
2004-05-21 12:43       ` Martin Dowie
2004-05-21 19:42         ` Randy Brukardt
2004-05-21 22:05           ` Martin Dowie
     [not found]           ` <c8luk4$29b$1@hercules.btinternet.com>
2004-05-21 23:16             ` Randy Brukardt
2004-05-22  7:55               ` Martin Dowie
2004-05-24 21:34                 ` Randy Brukardt
2004-05-25  5:48                   ` Martin Dowie
2004-05-25 20:25                     ` Randy Brukardt
2004-05-25 22:40                       ` Martin Dowie
2004-05-20 17:30 ` Martin Krischik
2004-05-21  7:57   ` Dmitry A. Kazakov
2004-06-04 12:59     ` Andersen Jacob Sparre
2004-05-21 16:46   ` Robert I. Eachus
2004-05-22  7:54     ` Martin Dowie
2004-05-22 16:18     ` Pascal Obry
2004-05-24 21:36       ` Randy Brukardt
2004-05-25 21:22       ` Robert I. Eachus
2004-06-04 23:26 ` Nick Roberts
2004-06-07 22:12   ` Karen
replies disabled

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