From JANSHEP@torolab2.vnet.ibm.com Mon Jun 27 14:25:59 1994
Received: from vnet.ibm.com by dkuug.dk with SMTP id AA22655
  (5.65c8/IDA-1.4.4j for <sc22wg5@dkuug.dk>); Tue, 28 Jun 1994 00:30:19 +0200
Message-Id: <199406272230.AA22655@dkuug.dk>
Received: from TOROLAB2 by VNET.IBM.COM (IBM VM SMTP V2R2) with BSMTP id 1902;
   Mon, 27 Jun 94 18:29:41 EDT
Date: Mon, 27 Jun 94 18:25:59 EDT
From: "Janice Shepherd" <JANSHEP@torolab2.vnet.ibm.com>
To: sc22wg5@dkuug.dk
Subject: generic procedures and section 14.1.2.3
X-Charset: ASCII
X-Char-Esc: 29

Here is a new request for interpretation. Comments would be appreciated.

David Mattoon: please include this in the X3J3 premeeting distribution.
Thanks.
Janice


To: X3J3
From: Janice Shepherd
Subject: RFI on generic interfaces and host association

I am submitting the following interpretation request for two reasons:

1) there appears to be difference amongst various implementations as to
whether this feature is valid or not,

2) at one time interpretation 82 contained the following edit, and
the letter ballot result for that version was 21-3, thus showing
that many committee members agreed with that edit. Since then
the answer to 82 has been simplified to only deal with the specific
question asked, instead of dealing with the larger issue of generic
routines and host association.
The edit was:
  In 12.1.2.2.1, insert the following after the sentence containing
  the long numbered list:
    If the local entity is nongeneric, any entity of the host that
    has this name as its generic name is inaccessible. If the local
    entity is generic and an entity of the host has this name as its
    generic name, the versions of the host entity that would fail
    to conform to the rules in 14.1.2.3. if they were made accessible
    in the local scoping unit are instead inaccessible.
This edit was part of the reason for adding the comment "see
interpretation 82" to interpretation 99.

NUMBER: 000180
TITLE: Unambiguous generic references
KEYWORDS: host association, generic name
DEFECT TYPE: Erratum
STATUS: X3J3 consideration in progress

QUESTION: Consider the following example:

     SUBROUTINE S()
       INTERFACE GEN1
         FUNCTION F1(I)
         END FUNCTION
         FUNCTION F2(I,J)
         END FUNCTION
       END INTERFACE
       INTERFACE GEN2
         FUNCTION G1()
         END FUNCTION
         FUNCTION G2(I)
         END FUNCTION
       END INTERFACE
       CALL SS()
       CONTAINS
          SUBROUTINE SS()
             INTERFACE GEN1
               FUNCTION F3(I,J,K)
               END FUNCTION
               FUNCTION F4(II)
               END FUNCTION
             END INTERFACE
             INTERFACE GEN2
               SUBROUTINE G3()
               END SUBROUTINE
             END INTERFACE
              A = GEN(1,2,3)  ! CALL TO F3
              A = GEN(1,2)    ! CALL TO F2
              A = GEN(1)      ! CALL TO F4
              CALL GEN2()     ! CALL TO G3
         END SUBROUTINE
      END

There are rules in section 14.1.2.3 that determine within a scoping
what procedures can have the same generic specification.  These rules
directly mention access of a generic procedure via use association, but
they make no mention of generic names accessed via host association.

There is evidence that the rules in section 14.1.2.3 were not
intended to apply to generic interfaces accessed by host association.
Section 14.1.2.4.1 indicates that a call to a generic name can
be resolved to a generic name in the host if there is the scoping unit
and the host scoping unit both agree that the generic name is the
name of a function or a subroutine. This indicates that in the example
above the definition of 'GEN2' is valid, even though 'G1' and 'G2'
are functions while 'G3' is a subroutine. If the rules set out in
14.1.2.3 were to apply then the definition of 'GEN2' would be invalid.

Do the rules in 14.1.2.3 apply to generic procedures accessed via
host association?

ANSWER: No. The rules in 14.1.2.3 were intended to apply to only ant in
those specific procedures declared to be generic in a scoping unit and
those accessed via use association.  An edit is included to clarify
this.

EDITS:
1. Add to the end of the first sentence of section 14.1.2.3
 [242:27]
   "when the generic interfaces for each of the specific procedures are
   declared in the same scoping unit, or accessed via use association."

2. Add to the end of the first paragraph of section 14.1.2.3
 [242:32]
    "When a generic procedure is accessed from a host scoping unit,
    the steps for resolving a procedure reference as described in
    14.1.2.4.1 have the same affect as if the rules restricted
    which specific versions from the host scoping unit can be
    accessed via the generic reference."

SUBMITTED BY: Janice C. Shepherd
HISTORY: 94-    m130 submitted with suggested answer
