J3/00-229 Date: 14 June 2000 To: J3 From: Van Snyder Subject: Request for Interpretation of ``prior specification'' QUESTION: What is a ``prior specification?'' The last normative paragraph of section 7.1.6.1 of the Fortran 95 standard, immediately before note 7.14 [94:38-41 in 97-007r2] states: ``If an initialization expression includes a reference to an inquiry function for a type parameter or an array bound of an object specified in the same , the type parameter or array bound shall be specified in a prior specification of the . The prior specification may be to the left of the inquiry function in the same statement.'' Unfortunately, there is no definition of ``specification.'' Consider: 1. INTEGER :: P(complicated_expression_for_lower_bound_1: & & complicated_expression_for_upper_bound_1, & & complicated_expression_for_lower_bound_2: & & complicated_expression_for_upper_bound_2) = & & RESHAPE( (/ 11, 21, 12, 22 /), SHAPE(P) ) (Notice the reference to P in the .) Some processors reason ``the `specification' of P is only the specifica- tion of its name, kind, rank and array bounds, and therefore is `prior' by the time the is encountered,'' and accept this. Others reason ``the `specification' of P is the syntax term defined by syntax rule R504 on page 47, which includes the , and it is therefore not `prior' until the is completely specified,'' and do not accept this. By way of further examples, which of the following should be standard conforming? 2. INTEGER(selected_int_kind(4)) :: A(KIND(A)) 3. INTEGER :: A(2,2*SIZE(A,1)+1) 4. CHARACTER :: C(10)*(SIZE(C,1)) 5. INTEGER :: P(10) = LBOUND(P,1) PREFERRED ANSWER: It would be useful if ``prior specification'' referred at most to a prior , but without including the part; the utility of this interpretation is illustrated most vividly by the first example above. I would hope that examples 1 and 5 are standard conform- ing, and I don't care whether the others are or not. This shouldn't be a problem, because the properties of the entity about which one wishes to inquire, viz. rank, array bounds and kind type parameters, are well defined without the part. Unfortunately, there is at present no syntax term to which to direct this kind of reference. Notice that the cited paragraph refers only to the type parameters and array bounds; it does not refer to parameter values. If a parallel paragraph concerning parameter values needs similar repair, that should be the subject of a different interpretation request. EDITS TO IMPLEMENT PREFERRED ANSWER: These suggested edits refer to the Fortran 95 standard. More edits may be necessary. In section 5.1, replace the first definition of (syntax rule R504, at [47:37]) by ``R504 <> [ ]'' Insert a new syntax rule after R504 (at [47:38+]) ``R504a <> [ ( ) ] [ * ]'' In the final normative paragraph of section 7.1.6.1, (at [94:38-41]) replace ``prior specification'' by ``prior '' twice. Notice that CHARACTER(len=*), PARAMETER :: P(len(P)) = (/ ('abc', i=1,len(P)) /) probably should not be allowed, so the paragraph may need more drastic surgery to restrict the inquiry concerning a prior to refer to kind type parameters, and require an inquiry of a nonkind parameter to refer to a prior .