J3/99-263r1 Date: 30th November 1999 To: J3 From: Malcolm Cohen Subject: Edits for IMPORT statement, plus host association fixups References: WG5/N1365, J3/99-197 1. Introduction 99-197r1 contains the specifications and syntax for the IMPORT statement, which imports names into interface bodies (which normally do not access anything from their host scoping unit). This paper contains the edits. 2. Edits against 99-007r2 [9:40+] Insert "[ ] ..." {Add IMPORT statement to between the USE statements and the IMPLICIT statements}. [14:5-] Insert "IMPORT statements" above "IMPLICIT NONE". [14:24+] Insert table entry "IMPORT statement No No No No No No Yes". [264:46+] Insert "R1207a <> IMPORT [ :: ] Constraint: The IMPORT statement is allowed only in an . Constraint: Each shall be the name of an entity defined in the enclosing scoping unit or accessible in the enclosing scoping unit." {Syntax for the IMPORT statement, restrict it to interface bodies only, require imported items to be available in the "host" scoping unit.} [265:24+] Insert "The IMPORT statement specifies that the named entities in the enclosing scoping unit are accessible in the interface body by host association. Entities defined in the enclosing scope shall be explicitly declared prior to the interface body. The name of an entity made accessible by an IMPORT statement may appear in no other specification statement that would cause any attribute of the entity to be specified in the interface body." {Semantics for IMPORT.} [265:43+] Add example "Note 12.5a The IMPORT statement can be used to allow module procedures to have dummy arguments that are procedures with assumed-shape arguments of an opaque type. For example: MODULE M TYPE T PRIVATE ! T is an opaque type ... END TYPE CONTAINS SUBROUTINE PROCESS(X,Y,RESULT,MONITOR) TYPE(T),INTENT(IN) :: X(:,:),Y(:,:) TYPE(T),INTENT(OUT) :: RESULT(:,:) INTERFACE SUBROUTINE MONITOR(ITERATION_NUMBER,CURRENT_ESTIMATE) IMPORT T INTEGER,INTENT(IN) :: ITERATION_NUMBER TYPE(T),INTENT(IN) :: CURRENT_ESTIMATE(:,:) END SUBROUTINE END INTERFACE ... END SUBROUTINE END MODULE The MONITOR dummy procedure requires an explicit interface because it has an assumed-shape array argument, but TYPE(T) would not be available inside the interface body without the IMPORT statement." [369:32] Before "The" insert "An interface body accesses named entities listed in IMPORT statements from its containing scoping unit by host association." [369:34] After "procedures," insert "abstract interfaces,". {Abstract interfaces should be inheritable via host association - they are by use association already}. [370:10+] Insert list item and renumber "(10.1) The name of an abstract interface in an abstract interface block;" {An abstract interface definition blocks host association.}