comp.lang.ada
 help / color / mirror / Atom feed
From: hyland@esosun.UUCP (Steve Hyland)
Subject: Re: Passing Procedures Over a Network
Date: Tue, 6-Oct-87 20:47:09 EDT	[thread overview]
Date: Tue Oct  6 20:47:09 1987
Message-ID: <75@kvasir.esosun.UUCP> (raw)
In-Reply-To: 2268@mandrill.CWRU.Edu

In article <2268@mandrill.CWRU.Edu> asheem@mandrill.UUCP (Asheem Chandna) writes:
>Now, any task making a procedure call will want a copy of the procedure in its
>local environment. If one such task was passed another procedure, surely a copy
>of that procedure should be in its local environment. Now, if a rendezvous from
>a task residing outside the local environment passes a procedure through an
>accept statement into the local environment, could one know the identity of the
>set of possible procedures at compile time (from all the procedures available
>of that particular type), and arrange to have copies resident in the local
>environment? Is this a feasible solution or are we just thinking crazy?  
>
>Or, what are some other methods that could be applied towards tackling this
>and related issues?
>
Asheem:

I was in on this discussion because I've been banging my head up against the
wall trying to design a nice mechanism for associating call_back procedures
and event_handlers for my X Toolkit package.

Here's what I'm now modeling:

I am creating mappings between objects in a domain and objects in a range.
Just as I can iterate through the objects in the domain and the objects
in the range, I can visit one object in the range.

In my mapping package, I supply a generic Visit procedure that allows me
this visitation right. The code looks something like this:

generic
  with procedure message ( parameter_list );

procedure Visit ( OBJECT : in range );

the procedure Visit calls this message procedure.

But the part I really like is this - message can be a procedure OR an entry,
so long as it has the same parameter list.

So, for instance, using tasking:

task Dummy is
  entry dummy_message ( parameter_list );
end Dummy;

with Dummy;
procedure Dummy_Visit is new Visit ( Message => dummy_message );

and when Dummy_Visit is called, it calls Dummy's entry. You could alternatively
associate that with a procedure call if you preferred.

I like this solution because it allows me to make a widget a more general
case with event_handlers and call_backs that can be associated with these
objects by the user.

I hope this helps. Has anyone else done anything similar ?

Steve Hyland
SAIC

Thanks to Mitchell Garth at Alsys for explaining about matching a formal
subprogram with an entry (LRM 12.3.6).

P.S. Grady, I got this idea from your new book. Any thoughts ?

      reply	other threads:[~1987-10-07  0:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1987-10-06  1:49 Passing Procedures Over a Network Asheem Chandna
1987-10-07  0:47 ` Steve Hyland [this message]
replies disabled

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