Subject: CONTEXT Specs, Syntax, and Edits J3/02-147 From: Kurt W. Hirchert (Meeting 160) 26 Feb 2002 ========== Background ========== As a result of comments made during a discussion at meeting 159, Van Snyder and I were given the task of devising a replacement for the IMPORT statement. The resulting rough proposal was presented in 01-397. 01-400 provided information on the motivations for the proposal. This document provides the formal specifications, syntax, and edits for this proposal. ============== Specifications ============== Completely remove from language the IMPORT statement (a mechanism for selective host association into an interface body from the scoping unit immediately containing it). In its place, introduce a mechanism to specify whether the specifications in an interface body are to be interpreted as though they appeared in an external procedure (no host association) or in a module procedure (host associate directly from the module). To maintain Fortran 90 design goals about text reuse, the specification of this mechanism should appear outside the text of the interface body. To maintain compatibility with Fortran 90/95, the default for this mechanism should be that the interface body is interpreted as though it were an external procedure. {* It might be interesting to bring back the IMPORT statement as a mechanism for selective host association into _any_ scoping unit, but that is not a part of this proposal. *} ====== Syntax ====== The syntax to (explicitly) specify that an interface body is to be interpreted as though it were an external procedure is CONTEXT EXTERNAL The syntax to specify that an interface body is to be interpreted as though it were a module procedure is CONTEXT MODULE [] This latter syntax is permitted only when the interface body is contained (directly or indirectly) in the module in question. The CONTEXT statement appears in the interface block before the interface bodies to which it applies. A CONTEXT statement remains in effect until a subsequent CONTEXT statement appears or the end of the interface block is reached. ===== Edits ===== 9:39 Delete entire line ("[] ...") 88:27 After "interface body", insert "in external context (12.3.2.1)". {* We want IMPLICIT to respect our CONTEXT mechanism. *} 88:28 Replace "internal or module procedure" with "internal procedure, module procedure, or interface body in module context". 244:11+ Insert " or " 245:6-8 Delete the existing R1209, C1209, and C1210, and insert the following replacement text: " R1209a is CONTEXT R1209b is EXTERNAL or MODULE [] C1209a (R1209b) The shall not be MODULE unless the is which it appears is contained (directly or indirectly) in a module and is not contained in an interface body in external context. C1209b (R1209b) The , if present, shall be the name of the module in which the is contained. " 245:31-35 Delete the entire paragraph (describing IMPORT) and insert the following replacement text: " The CONTEXT statement provides a context for the interpretation of interface bodies that follow it in the interface block but precede any subsequent CONTEXT statement. If the CONTEXT statement is a CONTEXT MODULE statement, the affected interface bodies are in <>, and they have access by host association to the entities of the module in which they appear. If the CONTEXT statement is a CONTEXT EXTERNAL statement, the affected interface bodies are in <>, and they have no host association. Interface bodies which have no preceding CONTEXT statement also are in external context. NOTE: The context of an interface body affects only the interpretation of the statements contained in it. There is no required connection to whether the procedure being described actually is an external procedure or a module procedure. " 246:Note_12.6: In the first line, replace "IMPORT" with "CONTEXT MODULE". After the "INTERFACE" line, insert "CONTEXT MODULE". 2 lines later, delete the "IMPORT T" line. In the last line, replace "IMPORT" with "CONTEXT MODULE". 387:9 After "interface body", insert "in module context". 387:10 Replace "its host ... interface body" with "the module that directly or indirectly contains it". - end -