--- ai12s/ai12-0214-2.txt 2019/07/06 00:26:43 1.4 +++ ai12s/ai12-0214-2.txt 2019/07/06 01:45:30 1.5 @@ -1,6 +1,16 @@ -!standard 4.5.7(5/3) 19-06-15 AI12-0214-2/02 +!standard 4.5.7(5/3) 19-07-05 AI12-0214-2/03 +!standard 4.5.7(6/3) +!standard 4.5.7(14/3) +!standard 4.5.7(21/3) +!standard 4.9(12.1/3) +!standard 4.9(32.5/3) !standard 5.4(2/3) +!standard 5.4(3) +!standard 5.4(11/3) +!standard 5.4(14/3) !class Amendment 18-05-16 +!status Amendment 1-2012 19-07-05 +!status ARG Approved 10-0-0 19-06-16 !status work item 18-05-16 !status received 18-04-12 !priority Low @@ -8,8 +18,8 @@ !subject Boolean conditional case expressions and statements !summary -A new form of case expression/statement, called the Boolean conditional -case, is introduced. +A new form of case expression/statement without a selecting_expression is +introduced. !problem @@ -28,14 +38,14 @@ !proposal -A Boolean conditional case expression consists of a number of alternatives -guarded by Boolean conditions. The conditions are such that only one is true -for any execution of a Boolean conditional case expression. If one is true, -the associated dependent_expression is executed. If none are true or more -than one are true, then Program_Error is raised. +A case expression without a selecting_expression consists of a number of +alternatives guarded by Boolean conditions. The conditions should be such +that only one is true for any execution of the case expression. If one is +true, the associated dependent_expression is executed. If none are true or +more than one are true, then Program_Error is raised. -The same basic rules applies to Boolean conditional case statements with -dependent_expressions replaced by statements. +The same basic rules applies to case statements without a +selecting_expression by changing dependent_expressions to statements. !wording @@ -57,17 +67,17 @@ choice_condition ::= choice_expression -condition_choice_list ::= choice_condition {| choice_condition} +condition_choice_list ::= choice_condition {'|' choice_condition} [Editor's note: We need "choice_condition" to avoid syntax ambiguity with -memebrships] +memberships] Modify 4.5.7(14/3): A condition is expected to be of any boolean type. {A choice_condition is expected to be of type Boolean.} -AARM Reason: We want all of the choices of a case expression to be of the +AARM Reason: We want all of the choices of a case_expression to be of the same type. Modify 4.5.7(21/3): @@ -77,15 +87,15 @@ Add after 4.5.7(21/3): For the evaluation of a case_expression without a selecting_expression, all -of the choice_expressions are evaluated. If exactly one choice_expression is -true, the dependent_expression of the conditional_case_expression_alternative +of the choice_conditions are evaluated. If exactly one choice_condition is +True, the dependent_expression of the conditional_case_expression_alternative containing this choice_condition is evaluated, converted to the type of the case_expression, and the resulting value is the value of the -case_expression. Otherwise (no choice_expression is True, or multiple -choice_expressions are True), Program_Error is raised. +case_expression. Otherwise (no choice_condition is True, or multiple +choice_conditions are True), Program_Error is raised. -AARM Ramification: This is not a check! It can't be suppressed as we would not -know what value to return in such a case. This is consistent with other +AARM Ramification: This is not a check! It cannot be suppressed as we would +not know what value to return in such a case. This is consistent with other case exceptions. [I suppose we could declare this a check and let it be suppressed -- a new @@ -97,13 +107,15 @@ Modify 4.9(12.1/3): -a conditional_expression all of whose conditions, selecting_expressions, -choice_expressions, and dependent_expressions are static expressions; + * a conditional_expression all of whose conditions, selecting_expressions, + {choice_conditions, }and dependent_expressions are static expressions. + In addition, for a case_expression without a selecting_expression, + exactly one of the choice_conditions is True; -Modify 4.9(32.5/3): +Add after 4.9(32.5/3): -a dependent_expression of a case_expression whose associated choice_condition -is static and whose value evaluating to False; or + * a dependent_expression of a case_expression whose associated + choice_condition is static and whose value equals False; or ----- @@ -133,13 +145,13 @@ Add after 5.4(13/3): For the evaluation of a case_statement without a selecting_expression, all -of the choice_expressions are evaluated. If exactly one choice_expression is -true, the sequence_of_statements of the conditional_case_statement_alternative -containing this choice_condition is executed. Otherwise (no choice_expression -is True, or multiple choice_expressions are True), Program_Error is raised. +of the choice_conditions are evaluated. If exactly one choice_condition is +True, the sequence_of_statements of the conditional_case_statement_alternative +containing this choice_condition is executed. Otherwise (no choice_condition +is True, or multiple choice_conditions are True), Program_Error is raised. -AARM Ramification: This is not a check! It can't be suppressed as we would not -know what value to return in such a case. This is consistent with other +AARM Ramification: This is not a check! It cannot be suppressed as we would not +know what statement to execute in such a case. This is consistent with other case exceptions. !discussion @@ -218,6 +230,152 @@ T_Increment'Result.Seconds = 0 and then T_Increment'Result.Minutes = 0 and then T_Increment'Result.Hours = X.Hours + 1); + +!corrigendum 4.5.7(5/3) + +@drepl +@xindent<@fa<case_expression>@fa<@ ::=@ >@hr +@ @ @ @b<case>@ @i<selecting_>@fa<expression@ >@b<is>@hr +@ @ @ @fa<case_expression_alternative>@ {,@hr +@ @ @ @fa<case_expression_alternative>}> +@dby +@xindent<@fa<case_expression>@fa<@ ::=@ >@hr +@ @ @ @b<case>@ @i<selecting_>@fa<expression@ >@b<is>@hr +@ @ @ @fa<case_expression_alternative>@ {,@hr +@ @ @ @fa<case_expression_alternative>}@hr +@ |@ @b<case is>@hr +@ @ @ @fa<conditional_case_expression_alternative>@ {,@hr +@ @ @ @fa<conditional_case_expression_alternative>}> + +!corrigendum 4.5.7(6/3) + +@dinsa +@xindent<@fa<case_expression_alternative>@fa<@ ::=@ >@hr +@ @ @ @b<when>@ @fa<discrete_choice_list>@ =@>@hr +@ @ @ @ @ @ @i<dependent_>@fa<expression>> +@dinss +@xindent<@fa<conditional_case_expression_alternative>@fa<@ ::=@ >@hr +@ @ @ @b<when>@ @fa<condition_list>@ =@>@hr +@ @ @ @ @ @ @i<dependent_>@fa<expression>> + +@xindent<@fa<choice_condition>@fa<@ ::=@ >@fa<choice_expression>> + +@xindent<@fa<condition_choice_list>@fa< ::=@ >@fa<choice_condition>@ {'|'@ @fa<choice_condition>}> + +!corrigendum 4.5.7(14/3) + +@drepl +A @fa<condition> is expected to be of any boolean type. +@dby +A @fa<condition> is expected to be of any boolean type. A @fa<choice_condition> is +expected to be of type Boolean. + +!corrigendum 4.5.7(21/3) + +@drepl +For the evaluation of a @fa<case_expression>, the @i<selecting_>@fa<expression> is +first evaluated. If the value of the @i<selecting_>@fa<expression> is covered by the +@fa<discrete_choice_list> of some @fa<case_expression_alternative>, then the +@i<dependent_>@fa<expression> of the @fa<case_expression_alternative> is +evaluated, converted to the type of the @fa<case_expression>, and the resulting +value is the value of the @fa<case_expression>. Otherwise (the value is not covered by +any @fa<discrete_choice_list>, perhaps due to being outside the base range), +Constraint_Error is raised. +@dby +For the evaluation of a @fa<case_expression> with a @i<selecting_>@fa<expression>, +the @i<selecting_>@fa<expression> is +first evaluated. If the value of the @i<selecting_>@fa<expression> is covered by the +@fa<discrete_choice_list> of some @fa<case_expression_alternative>, then the +@i<dependent_>@fa<expression> of the @fa<case_expression_alternative> is +evaluated, converted to the type of the @fa<case_expression>, and the resulting +value is the value of the @fa<case_expression>. Otherwise (the value is not covered by +any @fa<discrete_choice_list>, perhaps due to being outside the base range), +Constraint_Error is raised. + +For the evaluation of a @fa<case_expression> without a @i<selecting_>@fa<expression>, +all of the @fa<choice_condition>s are evaluated. If exactly one +@fa<choice_condition> is True, the @i<dependent_>@fa<expression> of the +@fa<conditional_case_expression_alternative> +containing this @fa<choice_condition> is evaluated, converted to the +type of the @fa<case_expression>, and the resulting value is the value of the +@fa<case_expression>. Otherwise (no @fa<choice_condition> is True, or multiple +@fa<choice_condition>s are True), Program_Error is raised. + +!corrigendum 4.9(12.1/3) + +@drepl +@xbullet<a @fa<conditional_expression> all of whose @fa<condition>s, +@i<selecting_>@fa<expression>s, and @i<dependent_>@fa<expression>s are static +expressions;> +@dby +@xbullet<a @fa<conditional_expression> all of whose @fa<condition>s, +@i<selecting_>@fa<expression>s, @fa<choice_condition>s, and +@i<dependent_>@fa<expression>s are static expressions. In addition, for +a @fa<case_expression> without a @i<selecting_>@fa<expression>, +exactly one of the @fa<choice_condition>s is True;> + +!corrigendum 4.9(32.5/3) + +@dinsa +@xbullet<a @i<dependent_>@fa<expression> of a @fa<case_expression> whose +@i<selecting_>@fa<expression> is static and whose value is not covered by the +corresponding @fa<discrete_choice_list>; or> +@dinst +@xbullet<a @i<dependent_>@fa<expression> of a @fa<case_expression> whose +associated @fa<choice_condition> is static and whose value equals False; or> + +!corrigendum 5.4(2/3) + +@drepl +@xindent<@fa<case_statement>@fa<@ ::=@ >@hr +@ @ @ @b<case>@ @i<selecting_>@fa<expression@ >@b<is>@hr +@ @ @ @ @ @ @ @fa<case_statement_alternative>@hr +@ @ @ @ @ @ {@fa<case_statement_alternative>}@hr +@ @ @ @b<end case>;> +@dby +@xindent<@fa<case_statement>@fa<@ ::=@ >@hr +@ @ @ @b<case>@ @i<selecting_>@fa<expression@ >@b<is>@hr +@ @ @ @ @ @ @ @fa<case_statement_alternative>@hr +@ @ @ @ @ @ {@fa<case_statement_alternative>}@hr +@ @ @ @b<end case>;@hr +@ |@ @b<case is>@hr +@ @ @ @ @ @ @ @fa<conditional_case_statement_alternative>@hr +@ @ @ @ @ @ {@fa<conditional_case_statement_alternative>}@hr +@ @ @ @b<end case>;> + +!corrigendum 5.4(3) + +@dinsa +@xindent<@fa<case_statement_alternative>@fa<@ ::=@ >@hr +@ @ @ @b<when>@ @fa<discrete_choice_list>@ =@>@hr +@ @ @ @ @ @ @fa<sequence_of_statements>> +@dinss +@xindent<@fa<conditional_case_statement_alternative>@fa<@ ::=@ >@hr +@ @ @ @b<when>@ @fa<condition_list>@ =@>@hr +@ @ @ @ @ @ @fa<sequence_of_statements>> + +!corrigendum 5.4(11/3) + +@drepl +For the execution of a @fa<case_statement> the +@i<selecting_>@fa<expression> is first evaluated. +@dby +For the execution of a @fa<case_statement> with a @i<selecting_>@fa<expression>, +the @i<selecting_>@fa<expression> is first evaluated. + +!corrigendum 5.4(13/3) + +@dinsa +Otherwise (the value is not covered by any @fa<discrete_choice_list>, perhaps +due to being outside the base range), Constraint_Error is raised. +@dinst +For the evaluation of a @fa<case_statement> without a +@i<selecting_>@fa<expression>, all of the @fa<choice_condition>s are +evaluated. If exactly one @fa<choice_condition> is True, the +@fa<sequence_of_statements> of the @fa<conditional_case_statement_alternative> +containing this @fa<choice_condition> is executed. Otherwise (no +@fa<choice_condition> is True, or multiple @fa<choice_condition>s are True), +Program_Error is raised. !ASIS

Questions? Ask the ACAA Technical Agent