No membership tests or short-circuit operation 86-07-23 AI-00128/04 1 | !standard 04.09 (02) 86-07-23 AI-00128/04 | !class binding interpretation 83-11-07 | !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/ADA Board 85-02-26 !status board-approved 84-06-29 !status committee-approved 84-02-06 !status received 83-11-07 !references 83-00180, 83-00242 | !topic No membership tests or short-circuit operations in static expressions !summary 84-07-13 Membership tests and short-circuit control forms are not allowed in static expressions because neither of these are operators. !question 84-07-13 The expression 10 in Some_Subtype is a static expression according to the current wording, even if Some_Subtype is not static. Is it intended that this expression be considered static if Some_Subtype is static? !recommendation 84-03-14 The use of a membership test or short-circuit control form makes an expression non-static. !discussion 84-03-14 The expression 10 in Some_Subtype is a static expression according to 4.9(2) since 10 is a primary having one of the permitted forms, "in" is not an operator (it is an operation; see 4.5(1,2)), and Some_Subtype is neither an operator nor a primary. This conclusion is not acceptable, however, since Some_Subtype need not be a static subtype, and if it is not static, the value of the expression cannot be determined at compile-time, as the language sometimes requires. For example, the following type declaration is illegal if the value given for digits exceeds SYSTEM.MAX_DIGITS: type T is digits BOOLEAN'POS(10 in Some_Subtype)+5; Since the value of 10 in Some_Subtype cannot necessarily be determined prior to execution of the main program, the legality of the type declaration cannot be determined. No membership tests or short-circuit operation 86-07-23 AI-00128/04 2 The current wording says, in part, that "an expression of a scalar type is said to be static ... only if .. every operator denotes a predefined operator." This wording is intended to say that the only operations permitted in static expressions are those denoted by operators. 10 in Some_Subtype is not a static expression because a membership test is not an operator -- it is an operation (see 4.5(3)). Because static expressions are only supposed to contain operators, the short-circuit control operations are also not allowed in static expressions.