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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:ac8:3225:: with SMTP id x34mr17301851qta.190.1574460468124; Fri, 22 Nov 2019 14:07:48 -0800 (PST) X-Received: by 2002:aca:4891:: with SMTP id v139mr13715742oia.175.1574460467957; Fri, 22 Nov 2019 14:07:47 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!g89no296606qtd.0!news-out.google.com!g53ni808qtg.0!nntp.google.com!g89no296603qtd.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 22 Nov 2019 14:07:47 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=70.109.61.2; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 70.109.61.2 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <358a3934-7cb2-4cff-8703-71410815f27e@googlegroups.com> Subject: Initializing an array of tasks with discrimants From: Jere Injection-Date: Fri, 22 Nov 2019 22:07:48 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:57594 Date: 2019-11-22T14:07:47-08:00 List-Id: I recently ran into a situation where I had an array of tasks that had discriminants (with a default), but I couldn't find a simple way to initialize them. I did come up with a workaround, but wanted to see if the language defined a way to do this: task type T(D: Integer := 3); task body T is begin null; end T; type A is array (Integer range <>) of T; V : A(1..10) := ????????? If they all had the same discriminant value, I can just create a subtype and do an array of the subtype, but in this case, the discriminants would not all be the same. My work around was a wrapper type: type Wrapper(D : Integer := 0) is record Impl : T(D); end record. type A is array (Integer range <>) of Wrapper; V : A(1..10) := (1 => (D => 1, others => <>), and so on But I was hoping there was a better way to do it simply. The Wrapper record isn't there to represent the intended design and doesn't really improve readability. It's essentially a workaround for something I cannot figure out. I tried many variations of qualified expressions and aggregates on the original task type elements, but all of them gave me errors about it expected the task type but found a composite type instead. Is there a particular aggregate that I can use to avoid the superfluous wrapper record?