09-303 To: J3 From: Malcolm Cohen Subject: Scoping unit fixes for BLOCK construct. Date: 2009 November 10 1. Introduction The standard often uses "scoping unit" in contexts where we need to consider BLOCK constructs. This paper attempts to fix these by making BLOCK constructs into a special kind of scoping unit. 2. Edits to 09-007r3 [15:34+] Insert new bullet item "- a BLOCK construct," [15:36+] Insert new definitions somewhere "block scoping unit = scoping unit that is a BLOCK construct; inclusive scope = scoping unit including any BLOCK construct whose host is that scoping unit or whose host is another BLOCK construct in the inclusive scope". [44:20] 3.2.5 Statement labels, p2, 2nd sentence, "in a scoping unit" -> "in its scope". {Better wording, safe against all scoping unit definition changes.} [109:28] 5.5 IMPLICIT statement, p4, penultimate sentence, "outermost scoping unit in which it appears" ->"innermost nonblock scoping unit containing its appearance". {A bit ugly.} [131:4,6] 6.7.3.2 Deallocation of allocatable variables, p5, Delete "or BLOCK construct" and delete "or block". [186:15] 8.2.1 Branch concepts, p1, "same scoping unit" -> "same inclusive scope". [186:26,30,37] 8.2.2 GO TO statement, C846, and 8.2.3 Computed GO TO statement, C847, and 8.2.4 Arithmetic IF statement, C848, Change "scoping unit" to "inclusive scope", thrice. [207:26] 9.5.6.2 Syntax, C905, "scoping unit" -> "inclusive scope". [211:15] 9.5.7.2 Syntax, C909, "scoping unit" -> "inclusive scope". [212:35] 9.6.2.1 Syntax, C914, "scoping unit" -> "inclusive scope". [214:7] 9.6.2.2 Format specification in a data transfer statement, C931, Change "scoping unit" to "inclusive scope". [231:4] 9.7.2 WAIT statement, C940, Change "scoping unit" to "inclusive scope". [231:33] 9.8.1 Syntax, C943, "scoping unit" -> "inclusive scope". [233:12] 9.9 FLUSH statement, C946, "scoping unit" -> "inclusive scope". [235:15] 9.10.2.1 Syntax, "scoping unit" -> "inclusive scope". [272:24,26] 11.2.2 The USE statement and use association, p2, Delete "or BLOCK construct", twice. [290:22] 12.5.1 Syntax of a procedure reference, C1253, Change "scoping unit" to "inclusive scope". [307:1,28,30] C1253 and 12.6.2.2p4, "scoping unit" -> "scope of the function name", thrice. [441:2] 16.1 Identifiers and entities, Change title to "Scopes, identifiers, and entities". {Because *here* is where we say what the scopes actually are.} [441:3] p1, "Entities are identified by identifiers within a scope that is a program, a scoping unit, a construct, a single statement, or part of a statement." -> "An entity is identified by an identifier. {We are about to list the scopes, don't repeat ourselves.} [441:5] After "program (2.2.2)" insert "excluding any nested construct that has a construct entity with the same identifier". {Applies to ASSOCIATE, BLOCK, DO CONCURRENT, FORALL, SELECT TYPE.} [441:6] Change "scoping unit (2.2)" to "inclusive scope, excluding any nested construct that has a construct entity with the same identifier". {Applies to ASSOCIATE, BLOCK, ... } [441:7] After "scope of a construct (7.2.4, 8.1)" insert "excluding any nested construct that has a construct entity with the same identifier". {Applies to ASSOCIATE, BLOCK, ... } [441:20] 16.2 Scope of global identifiers, Change title to "Global identifiers". {Nothing here about scopes, they were done in 16.1.} [442:1] 16.3 Scope of local identifiers, Change title to "Local identifiers". {Nothing here about scopes, they were done in 16.1.} [442:3] 16.3.1 Classes of local identifiers, p1, "Within a scoping unit, identifiers of entities in the classes" -> "Identifiers of entities in the following classes:" [442:11] Delete "in that scoping unit". {Scope is already established in 16.1p1.} [442:12] "Within a scoping unit" -> "Within its scope", [442:13] "that scoping unit" -> "that scope". [442:18] "Within a scoping unit" -> "Within its scope". [443:1] p4, After "in an inclusive scope excluding any nested construct that has a construct entity with the same identifier,". [443:32] "scoping units" ->"scope". {Should have been singular before anyway.} [444:17-19] 16.4 Statement and construct entities, p2, Delete whole paragraph which is now unnecessary after fixing the scope of global and local entities. {Previously wrong for nested constructs, also contradicted by p4 re statement entities.} [444:20-27] p3 and p4, Replace both paragraphs with "Even if the name of a statement entity is the same as another identifier and the statement is in the scope of that identifier, within the scope of the statement entity the name is interpreted as that of the statement entity." {Previously wrong when a construct entity also existed, also wrong for multiple statement entities in separate statements with the same name, and also for construct entities elsewhere.} [444:28-29] p4, Replace first sentence with "The name of a statement entity shall not be the same as an accessible global identifier or local identifier of class (1) (16.3.1), except for a common block name or a scalar variable name.". {Previously confusing and ambiguous re global identifiers.} [445:1-2] p9, Replace first sentence "Except ... s." with "If a FORALL statement, FORALL construct, or DO CONCURRENT construct does not have a , an shall not be the same as an accessible global identifier, local identifier, or identifier of an outer construct entity, except for a common block name or a scalar variable name.". {Broken for ASSOCIATE, BLOCK and SELECT TYPE.} [445:15] 16.5.1.1p1 Forms of name association, "scoping unit"->"scope", twice. [445:28] 16.5.1.3 Use association, "scoping units"->"scopes". [445:30] "scoping unit"->"scope", twice. 3. Non-edits The following possibly-problematic places seem, on closer examination, to be ok. [58:18] This is very poorly worded and could do with rewriting. [97:3-5] Looks ok - this is not exhaustive. [105:9] Looks ok. [105:18] Looks ok. [151:4] Looks ok. [404:1-4] Ok, except that it is self-contradictory and incomplete. And the last part belongs in 14.3. [443:13,14] Probably ok. [443:30] Probably ok. [444:31-43] Broken already in F2003, fix this later. ===END===