If you want to rename a procedure within the same module an interface
block might suffice… I use that primarily when I rename a procedure
and want the old name to still be available for backward compatibility, and a
few times to have an alternate name for intrinsic functions
Aside from renaming on the USE statement and the old wrapper procedure
method, procedure pointers and generic interfaces (with only one module
procedure) can be used as aliases.
Procedure pointers are usually OK as well, but there are some obscure
limitations on procedure pointers (mostly when passing the procedure name)
that might cause an issue.
You would think something like
PUBLIC :: ALIAS => EXISTING_NAME
PROCEDURE :: ALIAS => EXISTING_NAME
might work, but they do not. I think the natural place for a new feature
would be the PUBLIC statement.
When I was playing around with renaming intrinsics I made a little example program
to remind me the next time I wanted to rename something:
module M_aliases
implicit none
private
intrinsic sin, cos, tan
public :: tan, wrapper, sine, cosine
interface sine
procedure sin
end interface sine
procedure(real),pointer :: cosine => cos
contains
real function wrapper(x)
real,intent(in) :: x
intrinsic sin
wrapper=sin(x)
end function wrapper
end module M_aliases
program main
use M_aliases, only: tangent=> tan, sine, wrapper, cosine
implicit none
write(*,*)'on use statement ',tangent(1.0)
write(*,*)'wrapper ',wrapper(1.0)
write(*,*)'interface ',sine(1.0)
write(*,*)'procedure pointer',cosine(1.0)
end program main