From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ec4a7355f321a22b X-Google-Attributes: gid103376,public Path: controlnews3.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Phil Slater" Newsgroups: comp.lang.ada Subject: Re: Task discriminants Date: Fri, 21 May 2004 10:43:32 +0100 Message-ID: <40adcdfe_1@baen1673807.greenlnk.net> References: <40ACC50E.9040406@mail.usyd.edu.au> X-Trace: news.uni-berlin.de mze7yYgWwrhdBEeOer/egAZ1XMajbpWq3MG9TDI8aSFVIJrsW9 X-Orig-Path: baen1673807.greenlnk.net!baen1673807!not-for-mail X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Original-NNTP-Posting-Host: baen1673807.greenlnk.net Xref: controlnews3.google.com comp.lang.ada:734 Date: 2004-05-21T10:43:32+01:00 List-Id: 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" 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" 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" > > Newsgroups: comp.lang.ada > > To: > > 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 > > > > >