comp.lang.ada
 help / color / mirror / Atom feed
From: mockturtle <framefritti@gmail.com>
Subject: Re: passing parametars as determinants
Date: Tue, 21 Oct 2014 23:11:57 -0700 (PDT)
Date: 2014-10-21T23:11:57-07:00	[thread overview]
Message-ID: <a3ba492e-7ef4-4ebb-b2fb-0f4b668a2ad3@googlegroups.com> (raw)
In-Reply-To: <b8496ffe-6cc7-4235-a546-801e14920e95@googlegroups.com>

On Wednesday, October 22, 2014 7:12:56 AM UTC+2, comp...@gmail.com wrote:
> I have task type such as...
> 
> 
> 
> task type myTaskType (a: Integer; b: Integer);
> 
> 
> 
> I have type..... 
> 
> type myOtherType is array (1 ..N-1) of String (1..N);
> 
> I would like to pass array of myOtherType into my task type declaration like this...
> 
> task type myTaskType (a: Integer; b: Integer; c : myOtherType); ??
> 
> Is there way to do this?

As far as I know, not directly.  You have two alternatives:

  1.  Pass c as an access to string. 

  2.  Give to the task an entry point Init (or something similar) and use it to pass c.  Something like

    task body myTaskType is
       local_copy : myOtherType;
    begin
      accept Init(c: myOtherType) do
         local_copy := c;
      end Init;

      -- Back to serious work
    end myTaskType;

Why are not we allowed to use generic types as discriminants?  Honestly, I do not know, I have always been curious...  Note, however, that the task "parameters" are actually called "discriminants," so I guess they are closer (in some sense) to the record discriminants.

Riccardo


  parent reply	other threads:[~2014-10-22  6:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-22  5:12 passing parametars as determinants compguy45
2014-10-22  5:16 ` compguy45
2014-10-22  5:22 ` Simon Wright
2014-10-22 11:55   ` compguy45
2014-10-22 12:39     ` Dennis Lee Bieber
2014-10-22 15:57     ` Shark8
2014-10-22  6:11 ` mockturtle [this message]
2014-10-22  8:51   ` Georg Bauhaus
2014-10-22 17:25   ` Adam Beneschan
replies disabled

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