(j3.2006) RECURSIVE
Bill Long
longb
Sun Oct 25 12:54:03 EDT 2015
In looking at RECURSIVE/NON_RECURSIVE for 2015 implementation, there seem to be a couple of integration opportunitites.
1) F2008 prohibits (C1245) the prefix combination of ELEMENTAL and RECURSIVE. This is (naturally) missing in F2015. The wording seems carefully crafted to not require the NON_RECURSIVE keyword in any function definition, so there would not be literal incompatibilities with F2008, though it took a while to prove that theorem. A Note in this subclause might be helpful in explaining that RECURSIVE is the default, but that a procedure could be nonrecursive without specifying NON_RECURSIVE.
2) Note 7.31 in in the F2015 draft 15-007r2 [154:4+] (unchanged from F2008) the last sentence:
"The prohibition against recursion avoids the creation of a new instance of a procedure while construction of one is in progress.?
talks about the prohibition of certain recursive procedures being specification functions. Those functions are described at [153:1-4] as
"A function is a specification function if it is a pure function, is not a standard intrinsic function, is not an internal function, is not a statement function, and does not have a dummy procedure argument.
Evaluation of a specification expression shall not directly or indirectly cause a procedure defined by the subprogram in which it appears to be invoked.?
A specification function in an F2008 program that lacked the RECURSIVE prefix would hopefully never be called recursively. So, no issue for the compiler to check further. However, the implementation of the function might be different in the new standard (where recursive is assumed), and the ability to check for correct usage of a function that is presumed nonrecursive without having been declared NON_RECURSIVE is diminished.
Cheers,
Bill
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101
More information about the J3
mailing list