Is an interface block in a module supposed to honor the implicit none declaration in the module? I find that the "contained" procedures do so (as expected) but not the declarations in the interface block. Is this as per the standard?
A test program is below. (---which has j vs k usage which is kind of obvious but I encountered it in something like iFrom vs iForm. I agree that typically the interface blocks like this are "copied" from other files and /or auto generated; so such errors won't be that common, nevertheless.)
Subroutine Method(i, j)
!Implicit None ! without this statement there is no compile-time error for "j"
Integer :: i, k
End Subroutine Method
Subroutine Tech(i, j)
Integer :: i, k ! the error for j vs k is caught
i = 1
End Subroutine Tech
End Module OM
I would say that the observed behaviour makes sense. The interface block in the module provides information about the interface of the subroutine Method(i, j) in this case, which itself is a subroutine outside of the module (right?). So, that subroutine would also not be affected by the implicit none statement inside the module. Everything in between interface ... end interface should not depend on the settings in the module the interface is stated.
No, IMPLICIT NONE does not propagate into the INTERFACE block. The way to view INTERFACE is as a window into the external procedure. Nothing from the enclosing scope is imported unless IMPORT is used.
Thank you for the responses.
I do use "import"; it won't change the current behavior i.e. won't make implicit none "visible/applicable" in the scope of the Interface Block. I doubt if there is any (standard) way to get implicit none applied to all methods in the interface block. And that's all right considering the typical usage as mentioned in the original post.
p.s. for those who may come to this thread anew, here is a link to somewhat much broader discussion (that I didn't find/read earlier): https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/783797