comp.lang.ada
 help / color / mirror / Atom feed
From: mheaney@on2.com (Matthew Heaney)
Subject: Re: Subprogram Pointer in a Generic
Date: 17 Apr 2003 12:41:26 -0700
Date: 2003-04-17T19:41:27+00:00	[thread overview]
Message-ID: <1ec946d1.0304171141.31c6f4f7@posting.google.com> (raw)
In-Reply-To: 1ftiuys.1twhum2q9qa00N%claveman@grzorgenplatz.net

claveman@grzorgenplatz.net (Charles H. Sampson) wrote in message news:<1ftiuys.1twhum2q9qa00N%claveman@grzorgenplatz.net>...
> I'm using a procedure that takes a procedure pointer as an
> argument.  It's pretty standard stuff:
> 
>           type Parameterless_Proc_Ptr is access procedure;
>           procedure Register (The_Proc : in Parameterless_Proc_Ptr);
> 
> 
>      There are two questions.  (1) What are they trying to prevent by
> this restriction?  (2) Is there a more robust way of working around it?

The purpose of subprogram pointers in Ada95 is to implement callbacks,
e.g. for implementing a GUI.  You don't have full downward closures in
Ada95.

If you want to call a subprogram supplied by a caller, then use a
generic formal subprogram instead:

generic
   ...
package GP is 
   generic
      with procedure Op is <>;
   procedure Generic_Call_Op (...);
   ...
end GP;


Another possibility is to import the subprogram as a generic formal
subprogram of the generic package:

   generic
     with procedure Op is <>;
     ...
   package GP is ...;


Perhaps if you provided more information about what you're doing then
maybe we can give some more specific solutions.



  parent reply	other threads:[~2003-04-17 19:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-17  1:53 Subprogram Pointer in a Generic Charles H. Sampson
2003-04-17  2:54 ` James S. Rogers
2003-04-17  3:15   ` Samuel Tardieu
2003-04-17  5:27     ` tmoran
2003-04-17  3:12 ` Samuel Tardieu
2003-04-17  4:17   ` tmoran
2003-04-17 20:24     ` Robert A Duff
2003-04-18  2:59   ` Charles H. Sampson
2003-04-22 16:34   ` Warren W. Gay VE3WWG
2003-04-22 21:17     ` Robert A Duff
2003-04-23 20:46       ` Warren W. Gay VE3WWG
2003-04-17 19:41 ` Matthew Heaney [this message]
2003-04-17 20:39 ` Robert A Duff
2003-04-17 23:14   ` Randy Brukardt
replies disabled

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