J3/15-194 To: J3 Subject: Wart removal proposal -- Specification expressions From: Van Snyder & Malcolm Cohen Date: 2015 August 04 Reference: 15-101r2 1. Introduction =============== The question whether such things as integer :: B = bit_size(B) are permitted or prohibited has recently recurred on comp_lang_fortran. Interp F95/000090 included the above example, and several others, including character :: C(20)*(size(C,1)) The answer to the interp was that both of these declarations (and several additional examples) were not intended to be conforming. This resulted in 7.1.11p8, which says, in part "The prior specification may be to the left of the specification inquiry in the same statement, but shall not be within the same ..." which is somewhat ambiguous: It is reasonable that the extents of an array might not be established before before a is examined, as in the second example, but certainly one knows the type and type parameters before processing any in the statement. I.e., is the bit size specified by the or the ? 2. Specification ================ Allow any constant properties of an object to be referenced within an in its . In this context, "constant" excludes properties assumed from the initialization expression; that is, assumed-length and implied-shape PARAMETERs cannot use such lengths and shapes in the initialization expression. This would allow such things as integer :: B = bit_size(B) real :: E = sqrt(sqrt(epsilon(E))) integer :: Iota(10) = [ ( i, i = 1, size(iota,1) ) ] But the following would remain prohibited: integer :: x(10,Size(x,1)) character(*),parameter :: c = repeat('c',len(c)) 3. Syntax ========= The proposal is germane to R503 and R505 , but no syntax rules are changed. 4. Edits ======== [xviii] Introduction, p2, add new bullet at the beginning of the list "- Data declaration Constant properties of an object declared in its can be used in its .". [156:30] 7.1.12 Constant expression, p2 Append to the end of the sentence (before the full stop): "unless the specification inquiry appears within an ". making the whole sentence read: "The prior specification may be to the left of the specification inquiry in the same statement, but shall not be within the same unless the specification inquiry appears within an .". {Note: The first part of the sentence, requiring the specification to be to the left of the enquiry, stops assumed-length and implied-shape from causing problems.} ===END===