J3/13-312r2 To: J3 From: Van Snyder Subject: Specifications for US-08 -- explicit specification of EXTERNAL Date: 2013 October 14 Reference: 13-244r1, N1982 1. Requirements =============== Currently, there is no way to require explicit specification of the external attribute. Providing such a means would aid program checking. 2. Specification ================ Provide a means of requiring explicit declaration of the EXTERNAL attribute for external and dummy procedures. This characteristic shall be inherited by scoping units the same way that the implicit mapping is inherited. There shall be no means to override this characteristic in a nested scope. 3. Syntax proposals =================== Two proposals, based on IMPLICIT NONE and a new statement, have gained some traction. Straw vote: (a) IMPLICIT NONE (b) REQUIRE (c) EXPLICIT (d) Undecided. 3.1 Based on IMPLICIT NONE statement ------------------------------------ Allow an optional ( EXTERNAL ) annotation after IMPLICIT NONE, meaning that no references to implicitly external procedures are allowed. <> IMPLICIT <> IMPLICIT NONE [ ( EXTERNAL ) ] 3.2 A new REQUIRE statement --------------------------- If EXPLICIT is chosen, simply replace REQUIRE with EXPLICIT here. Provide a new REQUIRE statement, meaning that no references to implicitly external procedures are allowed. <> REQUIRE ( EXTERNAL ) Note: An alternative syntax would be REQUIRE [:] EXTERNAL, but that is lexically confusing with construct names so is not proposed. 4. Edits to 10-007r1 ==================== 4.1 Based on IMPLICIT NONE -------------------------- [Introduction p2+] In the new list of new features, insert a list item: " o Programs and procedures: An IMPLICIT NONE statement can require explicit declaration of the EXTERNAL attribute throughout a scoping unit and its contained scoping units. " [109:2+] Replace second alternative of " <> IMPLICIT NONE ( EXTERNAL )" [109:7+] Insert constraint "C583a If IMPLICIT NONE ( EXTERNAL ) appears within a scoping unit, the name of an external or dummy procedure in that scoping unit or a contained subprogram or BLOCK construct scoping unit shall be explicitly declared to have the EXTERNAL attribute.". 4.2 Based on REQUIRE -------------------- [Introduction p2+] In the new list of new features, insert a list item: " o Programs and procedures: A REQUIRE statement can require explicit declaration of the EXTERNAL attribute throughout a scoping unit and its contained scoping units. " [289:4+] Insert new subclause "12.4.3.7a REQUIRE statement The REQUIRE statement specifies that the EXTERNAL attribute (5.3.9) shall be explicitly declared for an external or dummy procedure. R1218a <> REQUIRE ( EXTERNAL ) C1223a If REQUIRE ( EXTERNAL ) appears within a scoping unit, the name of an external or dummy procedure in that scoping unit or a contained subprogram or BLOCK construct scoping unit shall be explicitly declared to have the EXTERNAL attribute.". 5. Other Discussion =================== It has been suggested in email that this feature could and/or should be extended to cover other situations, in particular: (a) prohibiting use of implicit interfaces, (b) revoking the requirement for explicit declaration of EXTERNAL, (c) if the chosen syntax is IMPLICIT NONE (EXTERNAL), adding an IMPLICIT NONE (TYPE) with the same meaning as the current IMPLICIT NONE. Subgroup thinks that these would be best handled as separate new features after the work is finished on the basic feature. No such separate new feature is as yet being proposed. ===END===