comp.lang.ada
 help / color / mirror / Atom feed
From: richw@ada-uts
Subject: Re: ForTran-Ada + flamette + questi
Date: Fri, 20-Jun-86 11:36:00 EDT	[thread overview]
Date: Fri Jun 20 11:36:00 1986
Message-ID: <4700042@ada-uts> (raw)
In-Reply-To: 8129@cca.UUCP


>>  ***** 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

  reply	other threads:[~1986-06-20 15:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1986-05-28 15:54 ForTran-Ada + flamette + question richw
1986-05-30 12:46 ` Russ Holden
1986-06-20 15:36   ` richw [this message]
1986-06-22  3:00     ` ForTran-Ada + flamette + questi Russ Holden
1986-06-22  7:49     ` Enumerated "procedural" parameters Alastair Milne
1986-07-03  7:03       ` Dick Dunn
1986-07-10 22:26     ` ForTran-Ada + flamette + questi friesen
1986-07-11 15:38       ` ForTran-Ada ... (really function pointers) markb
1986-07-14 17:01   ` ForTran-Ada + flamette + questi richw
1986-07-18 21:59     ` vilot
1986-07-22 12:59   ` stt
1986-08-07 13:26     ` Christopher Reedy
  -- strict thread matches above, loose matches on Subject: below --
1986-06-03 19:11 gore
replies disabled

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