Which makes the point I tried to make in the latest ACM Fortran Forum:
- If it was allowed to USE the interface for the subroutine itself
in the subroutine declaration.
- And if the language incorporated that when the subroutine contains an
interface to itself then the compiler must verify that the interface is
correct with respect to the actual declared dummy arguments.
- Then the circle would be closed and the interface would be forced to be
coherent to the subroutine.
Also this change to the language would make it easier in the case where
you have a set of interfaces declared in a module and you want to
use these interfaces in a subroutine but this subroutine happens to be
one of the subroutines that is declared in the interface module. Today
you need to do:
use interface_module, ALL_BUT: Myself
Since there is no ALL_BUT qualifier, but only an ONLY there is no easy
way to do this.
If I would have the language turn my way the earlier contributed example
would only need one additional line to accomplish what the original poster
wanted (I think)
/Nils
============================================================
MODULE Application_Interface
INTERFACE
SUBROUTINE P( ... )
! USE modules req'd for P's arguments
! declare arguments
END SUBROUTINE P
END INTERFACE
END MODULE Application_Interface
------------------------------------------------------------
MODULE A
USE Application_Interface
CONTAINS
SUBROUTINE S( ... )
CALL P( ... )
END SUBROUTINE S
END MODULE A
============================================================
Application specific code -- cannot be placed into a MODULE:
============================================================
SUBROUTINE P( ... )
USE Application_Interface ! This is not allowed today in Fortran <-----
! USE modules req'd for P's arguments
! declare arguments
! procedure body
END SUBROUTINE P
============================================================
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Nils Smeds (formerly Jönsson) http://www.pdc.kth.se/
Center for Parallel Computers e-mail: [log in to unmask]
Royal Institute of Technology Voice: +46-8-7909115
KTH Fax: +46-8-247784
S-100 44 Stockholm, Sweden Office: OB2, room 1546
-----------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|