comp.lang.ada
 help / color / mirror / Atom feed
From: macrakis@HARVARD.HARVARD.EDU (Stavros Macrakis)
Subject: Procedures as arguments
Date: Mon, 28-Oct-85 14:26:10 EST	[thread overview]
Date: Mon Oct 28 14:26:10 1985
Message-ID: <8510282007.AA01886@ucbvax> (raw)


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

             reply	other threads:[~1985-10-28 19:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1985-10-28 19:26 Stavros Macrakis [this message]
  -- strict thread matches above, loose matches on Subject: below --
1985-10-22 23:02 Procedures as arguments Geoff_Mendal
1985-10-22 20:39 prindle
1985-10-22 14:04 Walt Lazear
1985-10-24 22:16 ` Berlen_Oronzo
replies disabled

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