Thanks all, Robin, Sven, Kurt, Jan van Oosterwijk and Malcolm Cohen(NAG)!!!
PROBLEM:
module foo
INTERFACE name-generic
MODULE PROCEDURE func-gen1,func-gen2,func-gen3
END INTERFACE
contains
function func-gen1(x,ext)
... ... ... ... ... ...
end function func-gen1
function func-gen2(x,y,ext)
... ... ... ... ... ...
end function func-gen2
function func-gen3(x,y,z,ext)
... ... ... ... ... ...
end function func-gen3
end module foo
ANSWER: Malcolm Cohen (VERY THANKS!)
Because up until Corrigendum 3 (published only this year!) the Fortran
standard forbade this. Therefore last year the program was not legal, this
year it is legal (but not completely portable until the compilers that
checked the rules have been updated to the new set).
Prior to corrigendum 3, when two procedures were in a generic interface, one
of them had to have a single nonoptional dummy argument that:
(1) disambiguated by position - i.e. either there was no corresponding dummy
argument (by position) in the other procedure, or the corresponding
dummy argument had a different type, kind or rank.
and that SAME dummy argument also had to
(2) disambiguate by keyword - i.e. either there was no corresponding dummy
argument (viz with the same keyword) in the other procedure, or the
corresponding dummy argument had a different type, kind or rank.
So, considering CreatField1:
argument inx: does not disambiguate by position or keyword.
argument iext: does not disambuate by position or keyword.
And considering CreatField2:
argument inx: does not disambiguate by position or keyword.
argument iny: disambiguates by keyword but not by position.
argument iext: disambiguates by position but not by keyword.
Therefore the rules were not satisfied and so the program is in error.
After considering this matter, the Fortran committees (WG5 and X3J3) decided
that this was a mistake and changed the rules in corrigendum 3 to allow this
program. (In Fortran 95 the rules are relaxed further, but are even more
complicated as a result).
---------------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|