Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.BERKELEY.EDU
Path: utzoo!linus!philabs!cmcl2!seismo!lll-crg!ucdavis!ucbvax!harvard.harvard.edu!macrakis
From: macrakis@HARVARD.HARVARD.EDU (Stavros Macrakis)
Newsgroups: net.lang.ada
Subject: Procedures as arguments
Message-ID: <8510282007.AA01886@ucbvax>
Date: Mon, 28-Oct-85 14:26:10 EST
Article-I.D.: ucbvax.8510282007.AA01886
Posted: Mon Oct 28 14:26:10 1985
Date-Received: Thu, 31-Oct-85 09:03:04 EST
Sender: usenet@ucbvax.BERKELEY.EDU
Organization: The ARPA Internet
Lines: 30


> >can I...pass the name (address) of a procedure to another procedure...?
> >[I want to] call the supplied procedure until certain well-defined
> >conditions occur....
> Perhaps a generic subprogram with a formal subprogram parameter ...

Yes, a generic procedure appears to be exactly what is needed here.

> If generics don't do what you want, there might be another way, using
> address clauses. I DO NOT ADVOCATE THIS METHOD. In fact, the ARM states
> that doing so makes a program erroneous [ARM 13.5(8)]. ...
>   procedure General_Procedure(Some_Procedure_Address : in System.Address) is
>     procedure Supplied_Procedure;
>     for Supplied_Procedure use at Some_Procedure_Address;
>   begin  ...
> I doubt that this method would ever work in practice. I have yet to find an
> implementation that will even compile/execute this second (erroneous) method
> without blowing up (maybe that's an omen).

Actually, this appears to be illegal: `For each subprogram declaration,
there must be a corresponding body (except for a subprogram written in
another language, as explained in section 13.9).' [RM 6.3/3]  Note that an
explicit reference is made to chapter 13 for the pragma Interface case,
but not for address clauses.  A problem with the wording of 13.5 is that
it says `An address clause specifies a required address in storage for an
entity.'  I suspect this is intended to mean `where an entity is to be
placed' rather than `where an entity should be considered to be'.


	-s