comp.lang.ada
 help / color / mirror / Atom feed
From: Jere <jhb.chat@gmail.com>
Subject: Re: Initializing an array of tasks with discrimants
Date: Sat, 23 Nov 2019 08:50:11 -0800 (PST)
Date: 2019-11-23T08:50:11-08:00	[thread overview]
Message-ID: <0e718cae-0276-48a5-b39f-a809b82e41ff@googlegroups.com> (raw)
In-Reply-To: <qrat6p$2us$1@franka.jacob-sparre.dk>

On Saturday, November 23, 2019 at 4:12:59 AM UTC-5, Randy Brukardt wrote:
> "Robert A Duff" wrote in message 
> > Jere writes:
> >
> >> Is there a particular aggregate that I can use to avoid
> >> the superfluous wrapper record?
> >
> > See AI12-0212-1.TXT.  Not yet implemented in GNAT,
> > as far as I know.
> 
> If you wanted the indexes in order, you could use AI12-0061-1 (but I don't 
> know if that is implemented in GNAT yet, either):
> 
>      (for I in 1 .. 10 => (D => I, others => <>))
> 
> That still needs the wrapper record as I don't think you can write an 
> aggregate for a task. But a lot shorter.
> 
>                                         Randy.

yeah, I think I shot myself in the foot by trying to make the 
example as simple as possible.  My issue wasn't how to generate
the discriminants but simply how to initialize the task types
that had discriminants.  I mentioned in a separate email that
the real sceanrio is configuration values defined by enumerations
that change how the task works in slight ways.  They wouldn't be
unique or in any order.

My hope was that since Ada is so strongly typed I could have
done something like T'(D => Some_Option) and Ada would know
that since T is a task type it could correctly distinguish
it wasn't a record type instead.  At least GNAT cannot.

The wrapper record feels superfluous.  I"m not creating it because
it illustrates my design.  I'm using it because I don't know
a better way to initialize the type.

Thanks either way though

  reply	other threads:[~2019-11-23 16:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-22 22:07 Initializing an array of tasks with discrimants Jere
2019-11-22 22:39 ` Jeffrey R. Carter
2019-11-23 16:23   ` Jere
2019-11-22 23:57 ` Robert A Duff
2019-11-23  0:27   ` Anh Vo
2019-11-23  9:12   ` Randy Brukardt
2019-11-23 16:50     ` Jere [this message]
2019-11-23 16:25   ` Jere
2019-11-23  8:29 ` Dmitry A. Kazakov
2019-11-23 16:28   ` Jere
2019-11-23 17:03     ` Dmitry A. Kazakov
2019-11-23 16:57 ` Jere
2019-11-25 22:36   ` Randy Brukardt
replies disabled

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