comp.lang.ada
 help / color / mirror / Atom feed
* Arrays with discriminated task components
@ 2022-12-24 11:44 AdaMagica
  2022-12-24 18:05 ` Niklas Holsti
  2022-12-25 16:16 ` Niklas Holsti
  0 siblings, 2 replies; 6+ messages in thread
From: AdaMagica @ 2022-12-24 11:44 UTC (permalink / raw)


I've got a task type with a discriminant:

type Index is range 1 .. N;

task type T (D: Index);

Now I want an array of these tasks, where each task knows its identity (the index) via the discriminant, an iterated_component_association:

Arr: array (Index) of T := (for I in Index => ???);

How can I do this?

This works with access, but I find this extremely ugly:

Arr: array (Index) of access T := (for I in Index => new T (I));

Alternatively, I could use the traditional method with a Start entry with the index as parameter:

task type T is
  entry Start (D: Index);
end T;

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-12-26 16:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-24 11:44 Arrays with discriminated task components AdaMagica
2022-12-24 18:05 ` Niklas Holsti
2022-12-24 22:41   ` Jeffrey R.Carter
2022-12-25 15:32     ` Niklas Holsti
2022-12-25 16:16 ` Niklas Holsti
2022-12-26 16:39   ` AdaMagica

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