J3/14-237r1 To: J3 From: Van Snyder Subject: New work item proposal: Purity enhancement Date: 2014 October 13 Reference: 14-007r2 1. Discussion ============= (1) There appears to be no reason that the procedures in ISO_C_Binding, other than C_F_POINTER, are not pure. That they are impure can cause cascades of impurity. (2) What's wrong with a VALUE argument of a pure function appearing in the contexts prohibited by C1296? That it is prohibited seems to be collateral damage caused by prohibiting pointer argument modification; prohibiting VALUE serves no productive purpose. 2. Proposal =========== (1) Specify that procedures in ISO_C_Binding, other than C_F_POINTER, are pure. The reason for not making C_F_POINTER pure is that we would like to constrain against doing things with FPTR, in the same way we do for pointers, but the best we can do is prohibit them. One goal of the description of PURE procedures was to constrain against all impure behavior. (2) Permit modification of VALUE arguments in a pure function. 3. Edits ======== [xviii] Under "Intrinsic procedures and modules," append a sentence "All standard procedures in the ISO_C_BINDING intrinsic module, other than C_F_POINTER, are now pure." [xviii] Under "Program units and procedures", append a sentence "A dummy argument of a PURE function is permitted in value-definition context, and other contexts if it has the VALUE attribute." [318:23 C1296] Before the first "dummy argument" insert "pointer". [318:34 C1296(6)] Delete "or" [318:35 C1296(7)] Replace the full stop with ", or" [318:35+ C1296(7)+] Insert a list item " (8) as the actual argument to the function C_LOC from the ISO_C_BINDING intrinsic module. [444:19 15.2.3.1p1] Append a sentence: "The C_F_POINTER subroutine is impure; all other procedures in the module are pure."