From owner-sc22wg5@dkuug.dk  Thu May  1 00:47:03 2003
Received: (from majordom@localhost)
	by dkuug.dk (8.12.8p1/8.9.2) id h3UMl3ar071404
	for sc22wg5-domo; Thu, 1 May 2003 00:47:03 +0200 (CEST)
	(envelope-from owner-sc22wg5@dkuug.dk)
X-Authentication-Warning: ptah.dkuug.dk: majordom set sender to owner-sc22wg5@dkuug.dk using -f
Received: from mailhub.dfrc.nasa.gov (mailhub.dfrc.nasa.gov [130.134.81.12])
	by dkuug.dk (8.12.8p1/8.9.2) with ESMTP id h3UMimIo071383
	for <sc22wg5@dkuug.dk>; Thu, 1 May 2003 00:46:58 +0200 (CEST)
	(envelope-from maine@altair.dfrc.nasa.gov)
Received: from mail.dfrc.nasa.gov by mailhub.dfrc.nasa.gov with ESMTP for sc22wg5@dkuug.dk; Wed, 30 Apr 2003 15:42:38 -0700
Received: from altair.dfrc.nasa.gov ([130.134.20.211])
          by mail.dfrc.nasa.gov (Post.Office MTA v3.5.3 release 223
          ID# 0-71686U2500L200S0V35) with ESMTP id gov
          for <sc22wg5@dkuug.dk>; Wed, 30 Apr 2003 15:44:47 -0700
Received: from altair.dfrc.nasa.gov (localhost.localdomain [127.0.0.1])
	by altair.dfrc.nasa.gov (8.12.8/8.12.5) with ESMTP id h3UMipEc000919
	for <sc22wg5@dkuug.dk>; Wed, 30 Apr 2003 15:44:51 -0700
Received: (from maine@localhost)
	by altair.dfrc.nasa.gov (8.12.8/8.12.8/Submit) id h3UMioGi000914;
	Wed, 30 Apr 2003 15:44:50 -0700
From: Richard Maine <Richard.Maine@nasa.gov>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <16048.20962.734470.784601@altair.dfrc.nasa.gov>
Date: Wed, 30 Apr 2003 15:44:50 -0700
To: sc22wg5@dkuug.dk
X-Mailer: VM 7.07 under 21.4 (patch 8) "Honest Recruiter" XEmacs Lucid
X-Scanned-By: MIMEDefang 2.32 (www . roaringpenguin . com / mimedefang)
Sender: owner-sc22wg5@dkuug.dk
Precedence: bulk


The following should presumably be a paper for the Dresden meeting.

-- 
Richard Maine                |  Good judgment comes from experience;
Richard.Maine@nasa.gov       |  experience comes from bad judgment.
                             |        -- Mark Twain
------------------------------------

Date:     30 Apr 2003
To:       WG5
From:     Richard Maine
Subject:  Local/global entities

This paper was submitted as J3/03-160 for J3 meeting 164.
However, it go overlooked and was not processed at that meeting.
The edits have been updated to refer to line numbers and sections
of J3/03-007.

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, section 16.1.0 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)

  [407:4-5] "entity" -> "identifier" (4 times).

  [407: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.}

  [407:19] "A name that identifies" -> "The name of"

  [407:20] "shall" -> "is a global identifier and shall"

  [407:20] "used to identify" -> "the same as the name of"

  [407:22] "that identifies" -> "of"

  [407:22] "shall" -> "is a global identifier and shall"

  [407:22] "used to identify" -> "the same as the binding label of"

  [407:23] "used to identify" -> "of"

  {We have now defined "global identifier".  I think that, along
  with [407: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.}

  [408:2] "entities" -> "identifiers"

  [408: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.}

  [408:6] "generic names" -> "generic interfaces"

  [408:7] "group names" -> "groups"

  [408:8] "binding names" -> "bindings"

  [408:10] "entities of" -> "identifiers in"

  [408:7] Before the comma, insert
     ", external procedures accessed via USE"

  [408:12] "name that identifies a global entity" ->
     "global identifier used"

  [408:13] "used to identify a local entity" ->
     "the same as a local identifier"

  [408:14] "an identifier of a local entity" -> "a local identifier"

  [408:14-15] "used to identify another local entity" ->
     "the same as another local identifier"

  [408:16-17] "name that identifies a local entity" ->
       "local identifier"

  [408: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".}

  [408: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"

  [408:18] "The name of a local entity" -> "A local identifier"

  [409:5] "entities that have the same names as common blocks" ->
      "identifiers that are the same as common block names"

  [409:7] "If ... ," ->
     "If a local identifier is also the name of a common block,"

  [409:9] "identifies only the local entity" ->
     "refers only to the local identifier"

  [411:25-26,33-34]
     "name that identifies a global entity or local entity"
     -> "global identifier or local identifier"  (twice)

  [411:29,37] [412:3]  "the name of a global or local entity"
     -> "a global or local identifier"  (3 times)

  [411:32,40] [412:6] "that of the global or local entity"
     -> "the global or local identifier" (3 times)

  {It seems to me that 412:30-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.}

  [413:4] "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.}

  [413:24] "the name of a local entity and" ->
  "a local identifier in the scoping unit;"

  [413:26-27] "the name of a local entity" ->
  "a local identifier to the scoping unit"

  [413:28] "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.}

  [413:29,30] "local entity" -> "local variable" (twice)


Edits elsewhere

  [17:5] "is a local entity of" -> "has a local identifier in"

  [257:35] "entity" -> "identifier"

  {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".}

  [428:3] "entity" -> "variable"

  [428:3-4] Delete ", that is not a dummy argument,"

  [432:20] "entity" -> "identifier" (twice)

  [433:38] "local entity" -> "local identifier"

  [433:38] "An entity identified by a" -> "A"
