comp.lang.ada
 help / color / mirror / Atom feed
From: mheaney@ni.net (Matthew Heaney)
Subject: Re: Task Discriminants & Arrays
Date: 1997/05/15
Date: 1997-05-15T00:00:00+00:00	[thread overview]
Message-ID: <mheaney-ya023680001505970859120001@news.ni.net> (raw)
In-Reply-To: 337B09C9.62BB@sprintmail.com


In article <337B09C9.62BB@sprintmail.com>, johnvolan@sprintmail.com wrote:


>An interesting suggestion. We could have something like:
>
>  task type Process_Type
>    (Process_Id : Process_Id_Type := Get_New_Process_Id)
>     -- Note: We have to make sure this function is already
>     -- elaborated at this point; probably needs to be in another
>     -- package

No.  The rule that a procedure body is a "later declarative item" went away
in Ada 95:

declare
   Index : Natural := 0;

   function Get_New_Process_Id return Positive is
   begin
      Index := Index + 1;
      return Index;
   end;

   task type T (Id : Positive := Get_New_Process_Id) is
      entry E;
   end T;

   type TA is array (Positive range 1 .. 10) of T;

   O : TA;
...

This kind of application is precisely why the rule went away.  No more
Program_Error!

However, as Bob pointed out, this doesn't guarantee that O(I).Id = I.

Perhaps in Ada 0X we can add loop expressions (sort of like what you have
in Fortran).  That would allow more initializations at the point of
declaration of an object, instead of having to defer the initialization to
the executable region (e.g. the begin part of the body) because the
initialization requires a loop.

--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
<mailto:matthew_heaney@acm.org>
(818) 985-1271




  reply	other threads:[~1997-05-15  0:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-13  0:00 Task Discriminants & Arrays Matthew Heaney
1997-05-13  0:00 ` Robert A Duff
1997-05-14  0:00   ` W. Wesley Groleau (Wes)
1997-05-15  0:00     ` Robert A Duff
1997-05-15  0:00       ` John G. Volan
1997-05-15  0:00         ` Matthew Heaney [this message]
1997-05-15  0:00           ` John G. Volan
1997-05-15  0:00         ` Robert A Duff
1997-05-16  0:00           ` John G. Volan
1997-05-16  0:00             ` John G. Volan
1997-05-15  0:00     ` Mats Weber
1997-05-13  0:00 ` Jeff Carter
1997-05-13  0:00   ` Matthew Heaney
1997-05-13  0:00   ` John G. Volan
1997-05-14  0:00     ` Jeff Carter
replies disabled

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