From J.L.Schonfelder@liverpool.ac.uk Tue Mar 28 14:28:55 1995
Received: from mailhub.liverpool.ac.uk (mail.liv.ac.uk) by dkuug.dk with SMTP id AA23280
  (5.65c8/IDA-1.4.4j for <SC22WG5@dkuug.dk>); Tue, 28 Mar 1995 15:29:27 +0200
Received: from pop.liv.ac.uk by mail.liv.ac.uk with SMTP (PP);
          Tue, 28 Mar 1995 14:29:04 +0100
Date: Tue, 28 Mar 1995 14:28:55 GMT
From: Lawrie Schonfelder <J.L.Schonfelder@liverpool.ac.uk>
Subject: Re: Pointers to procedures
To: "John.Reid" <John.Reid@maths.anu.edu.au>
Cc: comp-fortran-90@mailbase.ac.uk, SC22WG5@dkuug.dk
Message-Id: <ECS9503281455F@liv.ac.uk>
Priority: Normal
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
X-Charset: ASCII
X-Char-Esc: 29




On Tue, 28 Mar 1995 17:56:39 +1000 John.Reid wrote:

 
> I gave a talk on Fortran 90 here at ANU, which has provoked a finite-element
> expert to ask why we do not have pointers to procedures in Fortran 90. 

As usual I think the call for pointers to procedures is really a request for 
procedure variables and I think if we are going to have mutilevel indirection 
such as pointers I think we should have the single level provided by variables 
as well or first. 
Procedures as currently defined are essentially constants. The symbolic name 
always refers to the same procedure (generics and dummy procedures aside).
Dummy Procedures have limited variable capacity in that the name may refer to 
different actual procedures on different calls but locally the name is 
essentially constant (like an intent(in) variable).
For many applications where a pointer to a procedure is needed a procedure 
variable would do. This requires a procedure declaration where the interface is 
specified including a name for the variable but no body. The interface does both 
of these but the name is currently that of an external proc or a dummy proc.
I think there is more syntax and semantics required here. 
The semantics I think we want is to establish the notion of "type" and 
"value" for a procedure. The type is the characteristics established by an 
interface definition. The value is the body of the procedure which is executed 
when the procedure is invoked. Normal existing syntax establishes a fixed 
symbolic name for a procedure type and value, a constant procedure. We new 
syntax to establish a name that has a specific procedure type but which may have 
different associated bodies established by assignment during the execution of 
the program. We might then need pointers and targets of procedure types (but 
fairly rarely I would have thought) when we wanted this extra level of aliasing.
This would make procedures into regular named entities. 
John's proposal so far merely creates components which are pointers to 
procedures which I think is too irregular.
There are also a number of questions that need thought in introducing procedure 
variables. Are the dummy argument/keyword names declared with the type and 
therefore a property of the variable or are they taken from the actual value 
procedure? How are generic procedures/overload sets handled? How does all this 
interact with argument passing; getting a seamless upgrade on the current 
procedure argument functionality will not be trivial?

Useful functionality but not easy language design. The analogue from C with 
simple pointers to an address which happens to be the start address of a proc is 
not applicable to Fortran.


--
Dr.J.L.Schonfelder
Director, Computing Services Dept.
The University of Liverpool, UK
e-mail J.L.Schonfelder@liv.ac.uk
phone: +44(51)794-3716
fax:   +44(51)794-3759



