09-301 To: J3 From: Malcolm Cohen Subject: Interp request on construct entities. Date: 2009 November 10 ---------------------------------------------------------------------- NUMBER: F03/? (maybe 0140?) TITLE: Type of nested construct entities. KEYWORDS: ASSOCIATE, DATA, FORALL, SELECT TYPE DEFECT TYPE: Erratum STATUS: J3 consideration in progress QUESTION: Consider the example: PROGRAM bad REAL x INTEGER i,y(10) ASSOCIATE (x=>i) ! B DATA (y(x),x=1,10)/10*1/ ! A DO x=1,10 ! B y(x) = SQRT(y(x)) ! B END DO ! B FORALL(x=1:10) y(x) = y(x)**2 ! C END ASSOCIATE ! B x = SUM(y) END PROGRAM Is this program conforming? That is: Within the ASSOCIATE construct, is X of type INTEGER? It certainly is in the statements marked with "! B". But according to 16.3 paragraph 2 [409:18-20], in the statement marked "! A", X has the type it has in the scoping unit, which would have to be REAL. And according to 16.3 paragraph 3 [409:25-27], in the statement marked "! C", X has the type it has in the scoping unit, which would have to be REAL. If X is type REAL for DATA and FORALL, the program would not be conforming, but it would be if X were of type INTEGER. ANSWER: Within the scope of a construct entity name, it was intended that a data-implied-do index or a FORALL index name should have the type and type parameters of the construct entity name. Edits are provided to clarify this. EDITS: [409:19] 16.3 Statement and construct entities, para 2, sentence 2, Before "scoping unit" insert "innermost executable construct or". {Makes a difference for DATA in ASSOCIATE and SELECT TYPE only.} [409:26] 16.3, paragraph 3, sentence 2, Before "scoping unit" insert "innermost executable construct or". {Makes a difference for FORALL in ASSOCIATE and SELECT TYPE only.} SUBMITTED BY: Malcolm Cohen HISTORY: 09-301 m190 Submitted ----------------------------------------------------------------------