J3/03-160 Date: 14 Mar 2003 To: J3 From: Richard Maine Subject: Local/global entities All edits herein are with respect to J3/02-007r3. Item T5 in section 2.12 of 03-107r1 advocates fixing confusions and errors relating to the terms "local entity", "local name", "global entity", and "global name". For example, the section on host association says that if a name appears in any of a bunch of contexts, "then it is the name of a local entity". This is apparently intended to distinguish it from host-associated names, but of course, it doesn't. Section 14.1.1 talks about "a name that identifies a global entity" in a way that apparently forgets that global entities may be identified by local names (via rename). (surprised there hasn't been an interp on that one because it sure sounds like it is saying that a widespread practice is illegal). Analysis The term "local variable" was introduced in 01-163; it cleared up several related confusions, but others remain. The term "local identifier" is used only in 11.2.2. It seems adequately defined, if somewhat narrow. In current use, it refers only to USE statements. If necessary, we could broaden it (as this paper proposes). Local-name is a bnf term in c11. This is used to imply a definition of the textual term "local name", which appears 6 times, none of them in normative text. As with "local identifier", the definition seems adequate, though restricted to USE statements. The term "global name" appears 7 times, none of which define it, and only 1 of which is in normative text. Annex C - 1 in c.8.1, 2 in c.9.2) C16 - 3 in Note 16.2, 1 in 16.4.1.3. The term "global entity" appears 16 times, once in its glossary definition, one in 12.1.2.2, and 14 in c16. Throughout, we hopelessly confuse the identifiers and the entities themselves. This is more then just editorial nit-picking; it results in statements that are certainly not what we intended to say. For example, c16.1 says that a name that identifies a global entity may not be used to identify a different global entity in the same program. This appears to forget completely about the fact that renaming with USE allows us to use local names to identify global entities; this is a mess. The term "local entity" appears 30 times, two in the glossary, one in 2.4.3.1.1, one in 12.1.2.4, and 26 in c16. As with "global entity", the usage seems very confused about the entity vs its name. Thus we see that the problem terms are "local entity" and "global" entity, and that the problem is largely restricted to c16. The terms "construct entity" and "statement entity" are also used, but they are less problematic because the scope of their identifiers is always the same as the scope where the entity itself might be said to "live". Those terms also aren't used very many times, so it wouldn't be difficult to revise them if necessary, but I propose to leave them alone, partly because the obvious terms "statement identifier" and "construct identifier" sound like identifiers of statements or constructs instead of identifiers with those scopes. In the large majority of the cases where the terms "local entity" or "global entity" appear, we are really talking about local identifiers or global identifiers. It is the identifiers, not the entities that have scope. That's what the first sentence of c16 pretty explicitly says. We have very little use for the concept of scope of an entity (as opposed to its identifier). I propose that we rid the draft of most reference to scope of global and local entities; instead referring to the scope of identifiers. I'll explicitly call out the few exceptions that seem merited. An awful lot of the instances of "local/global entity" already read something like "name that identifies a local/global" entity already; these are easy to change the simpler "local/global name", with the extra advantage that it is more likely to be correct (in the case of a local name of a global entity). Edits in c16 (the big part) [395:4-5] "entity" -> "identifier" (4 times). [395:17] "entities" -> "identifiers" {It seems convenient to leave the definition of a global entity, but to distinguish it from the definition of a global identifier. This will allow us to refer to a local identifier of a global entity. There may me multiple names "used to identify" a global entity, but only one of them is the name "of" the entity; that is the only global one.} [395:19] "A name that identifies" -> "The name of" [395:20] "shall" -> "is a global identifier and shall" [395:20] "used to identify" -> "the same as the name of" [395:21] "that identifies" -> "of" [395:21] "shall" -> "is a global identifier and shall" [395:21] "used to identify" -> "the same as the binding label of" [395:21] "used to identify" -> "of" {We have now defined "global identifier". I think that, along with [395:8-9], which says that a name is a form of identifier, is sufficient definition for the non-normative uses of the term "global name". We'll fix the one normative use below.} [396:2] "entities" -> "identifiers" [396:3] "entities" -> "identifiers of entities" {The next 3 edits avoid refering to "identifiers of names"; this also fixes the apparent omission of defined operators, because they do have generic interfaces, but not generic names.} [396:6] "generic names" -> "generic interfaces" [396:7] "group names" -> "groups" [396:8] "binding names" -> "bindings" [396:10] "entities of" -> "identifiers in" [396:7] Before the comma, insert ", external procedures accessed via USE" [396:12] "name that identifies a global entity" -> "global identifier used" [396:13] "used to identify a local entity" -> "the same as a local identifier" [396:14] "an identifier of a local entity" -> "a local identifier" [396:14-15] "used to identify a local entity" -> "the same as another local identifier" [396:16-17] "name that identifies a local entity" -> "local identifier" [396:17] "used to identify a local entity" -> "the same as a local identifier" {In addition to the other change, we might as well just say "class 1" instead of "the same class".} [396:Note 16.3 lines 1-2] "containing another local entity of the same class and having the same name" -> "that uses the same name as a local identifier of class 1 for a different entity" [396:18] "The name of a local entity" -> "A local identifier" [397:5] "entities that have the same names as common blocks" -> "identifiers that are the same as common block names" [397:7] "If ... ," -> "If a local identifier is also the name of a common block," [397:9] "identifies only the local entity" -> "refers only to the local identifier" [399:27-28,35-36] "name that identifies a global entity or local entity" -> "global identifier or local identifier" (twice) [399:31,40] [400:5] "the name of a global or local entity" -> "a global or local identifier" (3 times) [399:34,43] [400:8] "that of the global or local entity" -> "The global or local identifier" (3 times) {It seems to me that 400:32-35 neglects host association of entities that have identifiers other than names, but that is not the subject of this paper, and I have enough else to cover, so I'll pass over it.} {We could probably manage without the following edit; the original was correct, but this was the only normative use of "global name", so I thought it better to change it to the same term as we explicitly define and use elsewhere.} [401:1] "global name" -> "global identifier" {Fix a long-standing, run-on sentence while we are at it. Someone previously fixed same style run-on a few lines later, but this case was apparently overlooked.} [401:27] "the name of a local entity and" -> "a local identifier in the scoping unit;" [400:29-30] "the name of a local entity" -> "a local identifier to the scoping unit" [400:30-31] "Entities that are local (16.2) to" -> "Local identifiers of" {We have a separate and suitable definition of "local variable", so use it to simplify this edit; only variables can be initialized in DATA statements.} [401:32,33] "local entity" -> "local variable" (twice) Edits elsewhere [17:5] "is a local entity of" -> "has a local identifier in" [251:35] "entity" -> "identifier" {I don't know what to do at [252:14], so I've left it alone. It is nonsense as is - implying that dummy arguments aren't local entities, but I don't have a good term for procedure pointers that aren't dummy args or structure components. If they were variables, we could say "local variable", but I think that only data pointers are variables.} {I think automatic data objects are always variables; what else could they be? In that case, we can simplify this by using our definition of "local variable".} [415:35] "entity" -> "variable" [415:35-36] Delete ", that is not a dummy argument," [420:17] "entity" -> "identifier" (twice) [421:34] "local entity" -> "local identifier" [421:34] "An entity identified by a" -> "A"