J3/09-253 To: J3 From: Van Snyder Subject: Problems with procedure execution Date: 2009 June 30 References: 09-007r2 1. Introduction 12.5.3 is the only definition of "Function reference." It says "the function is executed." "Execution" is defined in the case of functions defined by subprograms but not in the case of statement functions or intrinsic functions. 12.6.2.4p2 says that an instance of a statement function is created when it is invoked, and that an instance of a procedure ceases to exist when its execution completes, but since statement functions aren't executed their instances do not cease to exist. 12.6.2.4 says "when a procedure defined by a subprogram is invoked, an instance of that subprogram is created" but this step isn't mentioned in 12.5.3 or 12.5.4. Since each instance has an independent set of dummy arguments, it's critical that this be done before arguments are associated, else there are no dummy arguments with which to associate the actual arguments. There are other niggling problems with the description of statement functions. 2. Edits w.r.t. 09-007r2. [302:7-8 12.5.3p1]------------------------------------------------------ Editor: Replace ", then" by ", then if it is defined by a subprogram an instance of it is created (12.6.2.4), and then". Replace ", and then the function is executed" by ". If the function is defined by a subprogram it is then executed. Otherwise it is evaluated as described in subclause \obs{12.6.4 or} 13.7." After "When execution" insert "or evaluation". [302:15 12.5.4p1]------------------------------------------------------- Editor: After "evaluated" insert ", then if it is defined by a subprogram an instance of it is created (12.6.2.4)". [309:16 12.6.2.4p3]----------------------------------------------------- Editor: Replace "completes it" by "of a procedure defined by a subprogram completes \obs{, or when evaluation of a statement function completes,} the instance". [312:21-22 12.6.4p1 C1271]---------------------------------------------- Function dummy procedures are functions. Editor: Delete "and function dummy procedures" and "or a function dummy procedure". [312:37 12.6.4p3]------------------------------------------------------- The first sentence duplicates 16.4p1 [444:12] and 16.4p8 [444:44-46]. It isn't necessary to say it yet again. 16.4 is the correct place to describe it. Editor: Delete "The dummy arguments have a scope of the statement function statement."