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.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!ima!inmet!ada-uts!richw From: richw@ada-uts Newsgroups: net.lang.ada Subject: Re: ForTran-Ada + flamette + questi Message-ID: <4700042@ada-uts> Date: Fri, 20-Jun-86 11:36:00 EDT Article-I.D.: ada-uts.4700042 Posted: Fri Jun 20 11:36:00 1986 Date-Received: Sun, 22-Jun-86 07:20:11 EDT References: <8129@cca.UUCP> Nf-ID: #R:cca.UUCP:8129:ada-uts:4700042:000:2083 Nf-From: ada-uts!richw Jun 20 11:36:00 1986 List-Id: >> ***** ada-uts:net.lang.ada / cca.UUCP!holden / 8:46 am May 30, 1986 >> Rich, you are missing out on the beauty of procedure passing. >> (Russell Holden) Pardon me, but... I've actually used this feature in many languages: Lisp, CLU, C, and Smalltalk. As a matter of fact, I'm in the process of rewriting a C program (which used pointers to functions) in Ada. >> Simply put it gives you the ability to dynamically bind actions >> without the invoker of the procedure having to know about the >> procedure being called. So does the enumeration-to-procedure mapping method I proposed. >> ... The use of enumerated types does no >> good and there are no real good solutions that I know of in ADA I'm sorry, but I simply fail to see how your examples provide conclusive arguments that this method will not work in general. GRANTED, the mapping method is less convenient for the programmer, but my point was that it is nevertheless possible in Ada at a reasonable expense (which I think is justifiable given that omitting procedure pointers from Ada prevented Ada from becoming even more complex). To be more concrete, the following outlines a package spec which one could use: package Mapper is type No_Argument_Procedure_Pointer is ( proc_A_0, proc_B_0, ... ); type One_Integer_Argument_Procedure_Pointer is ( proc_A_1_int, proc_B_1_int, ... ); : procedure Call ( p : in No_Argument_Procedure_Pointer ); procedure Call ( p : in One_Integer_Argument_Procedure_Pointer; i : in Integer ); : end Mapper The implementation of each "Call" procedure would simply be a case statement to the appropriate "real" procedure call. If anyone could provide an example where a Procedure_Pointer could not be used wherever one would like to use a "real" pointer to a procedure in a different langauge, I'd be grateful for a reply. Again, I apologize if I'm just being dense, but... Rich Wagner