J3/04-118 Date: 10 Dec. 2003 To: J3 From: Dan Nagle Subject: EXPLICIT Statement During the public comments for f03, Jean Vezina requested a way of requiring conversions between types be explicitly coded via type intrinsics. JoR has rejected the proposed CONVERSION EXPLICIT statement, but if we turn this around to EXPLICIT: CONVERSION, there are other items beyond conversions which fit comfortably on the explicit list, to wit: INTERFACES, CONNECTIONS, and possibly more. Note that EXPLICIT: DECLARATION is already spelled IMPLICIT NONE. I make no proposal to change that. Number: Title: EXPLICIT Statement Submitted By: J3 Status: For Consideration References: Basic Functionality: An EXPLICIT statement would require explicit declaration or action on the part of a program of some effects which automaticly default to a (possibly processor-dependent) value now. Rationale: Fortran has some defaults, some of which are processor- dependent, which may foil the task of writing correct programs. Some of these properties are silent conversion between types, preconnection of files with processor-dependent names, and the assumption of an implicit interface for an external name without an explicit interface, and possibly other "features" as well. The purpose of the EXPLICIT statement is to enable the programmer who desires to do so to defeat this behavior. The likely motivation is to write more clearly correct and better documented programs. The use of EXPLICIT may be required by software firms as a coding standard. Estimated Impact: Beyond one more statement to be supported, the effects of an explicit statement depend on the items the standard allows on the explicit-list. All are detectable by the processor, some may be more or less difficult to enforce. Detailed Specification: Add a new statement, the EXPLICIT statement. EXPLICIT: may include: CONVERSION- requires, within a scoping unit, use of type converting intrinsics when values are assigned between variables of different types, for example: I = A J = B X = I/J may produce a result other than the intended one. Currently, this may be an undetected cockpit error. CONNECTION- an EXPLICIT: CONNECTION in a main program would instruct the support library to disallow transfers to or from a unit not explicitly opened. This would eliminate the "fort.42" droppings from appearing mysteriously in working directories. The units specified by constants in ISO_FORTRAN_ENV should be unaffected by this statement. INTERFACE- requires, within a scoping unit, an explicit interface for any external symbol referenced. Whether this should disallow simple EXTERNAL statements is debatable. Other items may be desirable, but this is all I've considered. Example (in a main program): ! disallow most preconnected units in the program ! require explicit interfaces in the main program explicit: connection, interface History: