comp.lang.ada
 help / color / mirror / Atom feed
From: Gene <gene.ressler@gmail.com>
Subject: Re: Breaking a circularity
Date: Mon, 28 Mar 2011 15:38:25 -0700 (PDT)
Date: 2011-03-28T15:38:25-07:00	[thread overview]
Message-ID: <f22049a1-0983-4c22-ba94-b5da81aaba88@s9g2000yqm.googlegroups.com> (raw)
In-Reply-To: m2hbanpjbr.fsf@pushface.org

On Mar 28, 7:37 am, Simon Wright <si...@pushface.org> wrote:
> Ludovic Brenta <ludo...@ludovic-brenta.org> writes:
> > BTW, why does Event_Type have to be limited? If it weren't limited,
> > you would not need Event_Ptr_Type.  Also, why does it have to be
> > abstract?
>
> When I made my events limited, it was because any two events are
> different. In this case, we have
>
>    type Event_Type is abstract record
>       Id : Positive;
>       Time : Time_Type;
>    end record;
>
> so it probably won't make any sense for an Event to be copyable (what
> would Id be in the copy?). Of course the events could be privately
> nonlimited.

Yes.

>
> I do wonder what Id is _for_.

For tracing simulations.  They're consecutive in temporal order.

>
> You'll certainly need pointers somewhere, because Event_Type instances
> have to be held in the Queue. Indefinite_Ordered_Sets might do the
> trick, though. It would save the bother of having Handle deallocate the
> Event.

Yes and no.  The only reason for making Event_Queue generic is
so that a State can be passed through the dispatching Handle call.
Since this is an "in out" parameter that's invariably a record type,
it's being passed by pointer behind the scenes.  Yet there doesn't
seem
to be a way to take advantage of *this* pointer for breaking the
circularity.  (In (eeewwww) C  we could use a void* or other pointer
trick here.)

E.g. if there were a generic parameter type for "access to
incompletely
declared type," we could pull it off by making Event_Queue generic in
this way.



  reply	other threads:[~2011-03-28 22:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-28  4:11 Breaking a circularity Gene
2011-03-28  9:59 ` Ludovic Brenta
2011-03-28 11:37   ` Simon Wright
2011-03-28 22:38     ` Gene [this message]
2011-03-29  3:01       ` Randy Brukardt
2011-03-28 19:47   ` Gene
2011-03-28 10:15 ` Simon Wright
2011-03-28 21:31   ` Gene
2011-03-28 11:06 ` Martin
2011-03-28 22:26   ` Gene
2011-03-29 16:28     ` Martin
replies disabled

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