(j3.2006) Specification functions
Steidel, Jon L
jon.l.steidel
Fri Feb 24 17:01:37 EST 2017
References are to F2008 document (10-007r1)
In section7.1.11 Specification expressions, paragraph 5 states
"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."
Paragraph 5 goes on
"Evaluation of a specification expression shall not directly or indirectly cause a procedure defined by the subprogram in which it appears to be invoked."
Note 7.32 which follows ends with a sentence
"The prohibition against recursion avoids the creation of a new instance of a procedure while construction of one is in process."
Nowhere in this section is there a prohibition against a recursive specification expression. I scanned for occurrences of "recursi" and "specification expression" and found no prohibition of this elsewhere in the document. I checked "Pure subprograms" and it appears a PURE subprogram may be recursive. Should "is not a recursive function," be added to the list in paragraph 5? Or should the last sentence of note 7.32 be deleted?
F2015 reads the same. Since recursion is the default in 2015, specification functions in existing programs will need to be declared NONRECURSIVE if we really intended to disallow recursive specification functions.
I see no harm in a recursive function being used to specify a dimension in an automatic array.
-jon
More information about the J3
mailing list