Version 1.1 of ais/ai-00361.txt

Unformatted version of ais/ai-00361.txt version 1.1
Other versions for file ais/ai-00361.txt

!standard 11.3(2)          03-11-04 AI95-00361/01
!class amendment 03-11-04
!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.
[Author's note: would it be useful to have a simpler syntax for Reraise_Occurrence, too? The difficulty is to come up with a good syntax.]
!proposal
(See wording.)
!wording
Replace 11.3(2) by:
raise_statement ::= raise; | raise exception_name [with string_expression];
Add after 11.3(3):
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, it is returned by Ada.Exceptions.Exception_Message.
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
--!corrigendum
!ACATS test
An ACATS test (or additional test cases in the existing tests) should be constructed to test this feature.
!appendix

****************************************************************

Questions? Ask the ACAA Technical Agent