comp.lang.ada
 help / color / mirror / Atom feed
From: Darren New <dnew@san.rr.com>
Subject: Re: Dynamic dispatch again
Date: Mon, 08 Oct 2001 01:13:37 GMT
Date: 2001-10-08T01:13:37+00:00	[thread overview]
Message-ID: <3BC0FDB3.F185EDDF@san.rr.com> (raw)
In-Reply-To: yxHv7.8404$IY3.6643465@news1.rdc1.sfba.home.com

tmoran@acm.org wrote:
> 
> >OK, I'm still trying to figure out how to make one entry call wind up
> >calling code in different units.
> >...
> >Essentially, I have a basic manager task doing I/O, distributing
> >messages to "profiles". Each "profile" can get the same set of messages
> >(start, stop, are you ready, here's a message), but each responds to the
> >messages in different ways.
> 
> How about having a single "profile" task, and using tagged type "methods"
> to respond in different ways, eg:

I thought about this. The problem is that profiles are basically
implementing protocols. Here, I only get to have one piece of code per
profile execute per message. I.e., now I only get one accept per unit. I
can't do something like

begin
  accept initialize(params : in ...; ready : out boolean) do
    ...
  end accept;
  accept connection(params : ...) do
    -- set up connection
  end accept;
  send_message(...); -- peer receiving open is first to send message
  accept recv_message(...) do
    -- Process first answer
  end accept;
  stick_in_database(...);
  accept recv_message(...) do
    -- Process second answer
  end accept;
  ...
end;

I instead have to store the state and wait passively for a call to be
made. At this point, I might as well use a protected object, since I
still don't have a thread running in my code.

It would be very difficult, for example, to have the "are you ready to
start?" question answered "yes", followed immediately by starting to do
something. On the other hand, if I could get different entries being
invoked with a dynamic dispatch, something like the above would let me
immediately start sending as soon as the remote side requested a
connection, for example. It would also let me do something like "accept
a message coming in and put it on the screen, or accept a line from the
keyboard and send it over the socket."

But if Ada can't do this, I'm going to have to come up with a different
way of doing it which will be (I fear) far more painful and obtuse. I'm
expecting I'll have to basically package up all the parameters and build
queues of messages, and essentially reimplement all the entry queueing
stuff myself.

-- 
Darren New 
San Diego, CA, USA (PST). Cryptokeys on demand.
                   Who is this Dr. Ibid anyway, 
                  and how does he know so much?



  reply	other threads:[~2001-10-08  1:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-06  1:08 Dynamic dispatch again Darren New
2001-10-06 17:52 ` tmoran
2001-10-08  1:13   ` Darren New [this message]
2001-10-08  4:23     ` tmoran
2001-10-08 16:26       ` Darren New
2001-10-08 18:21         ` tmoran
2001-10-08 19:07           ` Darren New
2001-10-09  0:25             ` tmoran
2001-10-09  0:40               ` Darren New
2001-10-09  1:29                 ` Larry Hazel
2001-10-09  4:10                 ` tmoran
2001-10-09 15:40                   ` Darren New
2001-10-09 17:58                     ` tmoran
2001-10-09 19:26                       ` Darren New
2001-10-09 19:42                         ` tmoran
2001-10-09 20:23                           ` Darren New
2001-10-09 22:37                         ` tmoran
2001-10-10 18:17                           ` Darren New
replies disabled

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