Phillip Helbig wrote:
>
> > The only thing that comes to mind is to pass the user supplied procedure =
> > as a
> > dummy argument. For example:
> >
> > SUBROUTINE A( B )
> > INTERFACE
> > SUBROUTINE B( ... )
> > ! USE modules req'd for B's arguments
> > ! Declare other arguments
> > END SUBROUTINE B
> > END INTERFACE
> >
> > ! rest of A ...
> >
> > END SUBROUTINE A
> >
> > As long as B always has the same type of interface, A can be called from
> > some wrapper routine with different B modules.
>
> The problem with this approach, while it might me "made" to "work", is
> that since the user-supplied routine might not even be written when A is
> compiled, no sort of COMPILE-TIME automatic checking is possible
I think you've got this backwards. The interface block merely serves
to precisely specify the characteristics of the dummy procedure B, much
in the same way you would declare a dummy argument to be an integer, for
example. Arguments are checked when the code which *calls* A is compiled,
not when A itself is compiled. I'm assuming here that A is a module
procedure, and that the actual procedure corresponding to B has an explicit
interface (e.g., itself a module procedure). Whether or not the user
procedure B is written when A is compiled is irrelevent. The procedure
A must necessarily define the interface to B (it's calling it after all);
all the user is free to do is to implement a "B" with a conformable interface.
-Neil
--
Neil Carlson Voice: 505-665-1220
Motorola Computational Materials Group FAX: 505-665-5757
Los Alamos National Laboratory [log in to unmask]
Mailstop B221, Los Alamos, NM 87545 [log in to unmask]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|