J3/02-161r1 Date: 11 April 2002 To: J3 From: Dan Nagle Subject: Remove some restrictions on Optional Dummy Arguments This updates the line numbers and page numbers to the latest 007 and responds to a constructive criticism from Dick H. During the discussion at 160 re arguments to IEEE module intrinsics, some unhelpful restrictions on non-present procedure arguments were encountered. Current constraints encourage the use of local variables in place of optional arguments, since the non-present argument can only appear as the argument of the present() intrinsic. Specifically, the following "natural" constructions are at present illegal: real( kind= myreal), optional :: foo ! note that foo's kind is known real( kind= kind( foo)) :: local_foo ! but foo might not be present ... opt_arg: if( present( foo) )then ! the only legal usage here local_foo = foo else opt_arg local_foo = 42.0_kind( foo) ! or huge( foo) etc. endif opt_arg ... ! use local_foo for the rest of the procedure Since the inquiry intrinsics do not query the value of their arguments, but only such compile time quantities as kind, and since there are reasonable uses of such information, a slight relaxation of the rules for non-present dummys is proposed. Specifically, the use of non-present dummys of intrinsic types in compile time intrinsics should be allowed. I think this list is reasonably limited to: kind(), those listed in 13.5.6 Numeric Inquiry Functions, and bit_size(). (I'll happily modify this list to meet J3's concerns.) Edits: (Edits are against 02-007r1) (Modify fourth restriction listed in 12.4.1.6) 270:32 Replace "PRESENT intrinsic function" with "PRESENT intrinsic function, or, if the non-present dummy argument is of an intrinsic type and is otherwise allowed as an argument, to KIND (13.7.57), BIT_SIZE (13.7.16), or one of the Numeric Inquiry Functions (13.5.6)"