From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!esosun!hyland From: hyland@esosun.UUCP (Steve Hyland) Newsgroups: comp.lang.ada Subject: Re: Passing Procedures Over a Network Message-ID: <75@kvasir.esosun.UUCP> Date: Tue, 6-Oct-87 20:47:09 EDT Article-I.D.: kvasir.75 Posted: Tue Oct 6 20:47:09 1987 Date-Received: Fri, 9-Oct-87 22:31:08 EDT References: <2268@mandrill.CWRU.Edu> Reply-To: hyland@kvasir.UUCP (Steve Hyland) Organization: SAIC, San Diego List-Id: 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 ?