J3/15-193 To: J3 From: Van Snyder Subject: New work item proposal: Purity enhancement Date: 2015 August 04 Reference: 15-007r2, 14-237r2 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, viz. C_ASSOCIATED C_F_PROCPOINTER C_FUNLOC C_LOC C_SIZE0F 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 a variable definition context, and other contexts, if it has the VALUE attribute." [318:29 C1296] Before the first "dummy argument" insert "pointer". [319:2 C1296(6)] Delete "or" [319:3 C1296(7)] Replace the full stop with ", or" [319:7+ C1296(7)+] Insert a list item " (8) as the actual argument to the function C_LOC from the ISO_C_BINDING intrinsic module. [452:20 15.2.3.1p1] Append a sentence: "The C_F_POINTER subroutine is impure; all other procedures in the module are pure."