J3/05-147 To: J3 From: Dan Nagle Subject: New Intents Date: 2005 Jan 24 At M167, this idea got a Hate .. Love score of 4 - 2 - 5 - 1, so it's (highly) subject to modification. However, I think it's worth pursuing. The degree of difficulty was ranked as 5 on the John Reid scale. Either of these two new intents could be removed without affecting the other. Number: Title: New Intents Submitted By: J3 Status: For Consideration References: J3/04-135 Basic Functionality: Add two new intents for procedure arguments: INTENT( SCRATCH) specifies that the argument is undefined on entry and return, the argument may be used for scratch work space only. Compilers may be able to optimize this argument aggressively. INTENT() specifies that the argument will not be used within the procedure, it is present for disambiguation only. Compilers may be able to better follow the data flow of a program when the procedure and its caller are not both visible. Rationale: Many older Fortran programs have dummy arguments which are used for scratch work space only. Any use of existing argument intents gives wrong information to the compiler. Also, in the process of converting common blocks to allocatable dummy arguments, there is no proper intent for 'scratch' variables. A scratch array may be 'promoted' to a scalar when it is known that it really is scratch. Also, initial and/or final values may not need to be computed. Sometimes, an argument is used solely to disambiguate a procedure reference. The canonical example is the RNG function, where the argument is used only to select the result kind. Again, any use of the current intents misinforms the compiler. Estimated Impact: The impact was rated as 5 on the John Reid scale at 167. Detailed Specification: Two new procedure arguments are proposed, SCRATCH and a disambiguation-only intent. An argument intended to be used for scratch work space only might be designated INTENT(SCRATCH). An argument intended to disambiguate only might be designated INTENT(), since there is no intent to use the argument within the procedure. INTENT(SCRATCH) indicates that the argument passes no information into or out of the procedure; it is used for scratch work space only within the procedure. Such an argument must be definable, for example, it must not be a constant, nor an expression. An INTENT(SCRATCH) argument is undefined upon procedure entry and upon procedure exit. INTENT() indicates that the argument is used to disambiguate the generic reference only, it may not be used within the procedure in a context where its definition is required. It may be used in a specification inquiry only. It may not be optional, since optional isn't used for generic resolution. History: J3/04-135 at M167