All guards need not be evaluated first 86-07-23 AI-00030/07 1 | !standard 09.07.01 (05) 86-07-23 AI-00030/07 | !class ramification 86-02-20 | !status approved by WG9/AJPO 86-07-22 | !status approved by Director, AJPO 86-07-22 | !status approved by WG9/Ada Board 86-07-22 | !status approved by Ada Board 86-07-22 !status approved by WG9 86-05-09 !status committee-approved (8-0-0) 86-02-20 !status work-item 83-10-10 !references 83-00125, 83-00126, 83-00127, 83-00318 !topic All guards need not be evaluated first !summary 86-03-05 In the execution of a selective wait statement, the evaluation of conditions, delay expressions, and entry indices is performed in some order that is not defined by the language, except that a delay expression or an entry index cannot be evaluated until after the condition for the corresponding alternative is evaluated and found to be true. !question 86-01-16 When evaluating the expressions in a selective wait, must the delay expressions and entry family indexes be evaluated immediately after determining that an alternative is open, or are all the conditions evaluated first, or is the order undefined? !response 86-03-05 9.7.1(5) says: For the execution of a selective wait, any conditions specified after WHEN are evaluated in some order that is not defined by the language; open alternatives are thus determined. For an open delay alternative, the delay expression is also evaluated. Similarly, for an open accept alternative for an entry of a family, the entry index is also evaluated. Selection and execution of one open alternative, or of the else part, then completes the execution of the selective wait; .... By saying the delay expression is "also" evaluated, one might argue that this means immediately after determining whether the associated alternative is open. On the other hand, one might argue that since the standard says "any conditions" (note use of the plural), and since only a single condition can follow a single WHEN, the implication is that all conditions are evaluated to determine which alternatives are open, and then, delay expressions and entry family indexes are evaluated for open alternatives. Possible interpretations are: 1. all conditions are evaluated first; or All guards need not be evaluated first 86-07-23 AI-00030/07 2 2. evaluation of a condition must be followed by evaluation of a delay expression or index; or 3. evaluation of conditions, delays, and indexes can proceed in any order as long as no delay expression or index is evaluated for a closed alternative. When a specific order is intended, the standard always uses phrases like "... first evaluated ... then ... finally ...". Thus, the current wording supports interpretation 3, which is the least restrictive.