(j3.2006) Specification functions

Steve Lionel steve
Fri Feb 24 17:06:07 EST 2017


I read this as prohibiting a specification function from invoking the
procedure in which it is used as a specification function, not prohibiting
the specification function itself from being recursive.

Steve

On Fri, Feb 24, 2017 at 5:01 PM, Steidel, Jon L <jon.l.steidel at intel.com>
wrote:

> 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
>
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3
>



-- 
.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.j3-fortran.org/pipermail/j3/attachments/20170224/5a75873c/attachment-0001.html 



More information about the J3 mailing list