J3/04-128 Date: 13 Dec. 2003 To: J3 From: Dan Nagle Subject: LOCAL for non-present optional arguments The suggestion that optional dummy arguments have a local attribute allowing them to be used when the corresponding actual argument is not present has been discussed for some time. This paper proposes a scheme for doing so. Number: Title: LOCAL for OPTIONAL Dummy Arguments Submitted By: J3 Status: For Consideration References: Basic Functionality: Create a local variable in place of a non-present dummy argument. Possibly, specify an initial value of the variable Rationale: Many uses of optional dummy arguments require that the procedure detect the non-presence, and supply a default value to a local variable in place of the missing argument's value. Specifying this at a high level seems to have value. Estimated Impact: This proposal may interfere with current schemes for detecting non-present arguments, and may encourage detection of the default value rather than use of the higher-level present intrinsic. However, this has been discussed for so long in so many forums, that further consideration is warranted. Detailed Specification: LOCAL Attribute of OPTIONAL procedure arguments. LOCAL [ ( i-e ) ] Specifies that when the dummy argument is not present a local variable exists in the procedure with the same name. The dummy argument must not have INTENT( OUT) if the initial value is specified. The procedure must have an explicit interface, but it needed that for the OPTIONAL part, anyway. If { i-e ) is present, the local variable has the initial value given by the initialization expression. Example: INTEGER, OPTIONAL, LOCAL( -HUGE( FOO)) :: FOO Specifies that if FOO is present, then processing occurs as at present. If FOO is not present, a local variable named FOO exists and has the initial value -HUGE( FOO). History: