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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,72113392dc4997bd X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-17 12:41:27 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: mheaney@on2.com (Matthew Heaney) Newsgroups: comp.lang.ada Subject: Re: Subprogram Pointer in a Generic Date: 17 Apr 2003 12:41:26 -0700 Organization: http://groups.google.com/ Message-ID: <1ec946d1.0304171141.31c6f4f7@posting.google.com> References: <1ftiuys.1twhum2q9qa00N%claveman@grzorgenplatz.net> NNTP-Posting-Host: 66.162.65.162 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1050608487 30004 127.0.0.1 (17 Apr 2003 19:41:27 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 17 Apr 2003 19:41:27 GMT Xref: archiver1.google.com comp.lang.ada:36247 Date: 2003-04-17T19:41:27+00:00 List-Id: 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.