!standard 11.3(2) 04-05-27 AI95-00361/03 !standard 11.3(3) !standard 11.3(4) !standard 11.4.1(10) !class amendment 03-11-04 !status Amendment 200Y 04-01-13 !status ARG Approved 9-0-2 03-12-13 !status work item 03-11-04 !status received 03-11-04 !priority Medium !difficulty Easy !subject Raise with message !summary A string expression may be specified in a raise statement. !problem It would be nice to have a simpler syntax for specifying a message when raising an exception, as the current method of calling Raise_Exception is quite cumbersome. !proposal (See wording.) !wording Replace 11.3(2) by: raise_statement ::= raise; | raise exception_name [with string_expression]; Add after 11.3(3): Name Resolution Rules The expression, if any, in a raise_statement, is expected to be of type String. Replace the second sentence of 11.3(4) by: For the execution of a raise_statement with an exception_name, the named exception is raised. If a string_expression is present, a call of Ada.Exceptions.Exception_Message returns that string. Replace the third sentence of 11.4.1(10) by: For a raise_statement with an exception_name and a string_expression, Exception_Message returns that string. For a raise_statement with an exception_name but without a string_expression, Exception_Message returns implementation-defined information about the exception occurrence. !discussion Ideally we would like to say that the expression is expected to be of any string type. This would make it possible to raise exceptions with localized strings. Unfortunately, this would make any literal ambiguous, and literals are expected to be the most frequent expressions in raise-with statements. We don't want to force users to use qualification all over the place. !example raise Not_Valid_Error with "Parent not valid"; !corrigendum 11.3(2) @drepl @xcode<@fa@ft<@b >@fa<[>@ft<@i>@fa> @dby @xcode<@fa@ft<@b@fa<; |> @ft<@b @i>@fa>@ft<@b @i>@fa> !corrigendum 11.3(3) @dinsa The name, if any, in a @fa shall denote an exception. A @fa with no @i@fa (that is, a @i) shall be within a handler, but not within a body enclosed by that handler. @dinst @i<@s8> The @fa, if any, in a @fa, is expected to be of type String. !corrigendum 11.3(4) @drepl To @i is to raise a new occurrence of that exception, as explained in 11.4. For the execution of a @fa with an @i@fa, the named exception is raised. For the execution of a re-raise statement, the exception occurrence that caused transfer of control to the innermost enclosing handler is raised again. @dby To @i is to raise a new occurrence of that exception, as explained in 11.4. For the execution of a @fa with an @i@fa, the named exception is raised. If a @i@fa is present, a call of Ada.Exceptions.Exception_Message returns that string. For the execution of a re-raise statement, the exception occurrence that caused transfer of control to the innermost enclosing handler is raised again. !corrigendum 11.4.1(10) @drepl Raise_Exception raises a new occurrence of the identified exception. In this case, Exception_Message returns the Message parameter of Raise_Exception. For a @fa with an @i@fa, Exception_Message returns implementation-defined information about the exception occurrence. Reraise_Occurrence reraises the specified exception occurrence. @dby Raise_Exception raises a new occurrence of the identified exception. In this case, Exception_Message returns the Message parameter of Raise_Exception. For a @fa with an @i@fa and a @i@fa, Exception_Message returns that string. For a @fa with an @i@fa but without a @i@fa, Exception_Message returns implementation-defined information about the exception occurrence. Reraise_Occurrence reraises the specified exception occurrence. !ACATS test An ACATS test (or additional test cases in the existing tests) should be constructed to test this feature. !appendix ****************************************************************