!standard 8.3(16) 10-02-15 AI05-0205-1/01 !standard 8.3(18/2) !class binding interpretation 10-02-15 !status work item 10-02-15 !status received 09-12-05 !priority Low !difficulty Easy !qualifier Omission !subject An extended return statement declares a name usable inside the statement !summary An extended_return_statement declares a name for a return object that is visible after the reserved word "do" (if any). !question 3.1(6) defines an extended_return_statement to be a declaration of its defining_identifier. 8.3(16) says that a declaration is hidden from all visibility until the end of the declaration. This means that in: return X : T do X := Foobar; -- Error? (No.) end return; The reference to X in the body is illegal by 8.3(16) as it is hidden from all visibility. This cannot be what was intended (X wouldn't be visible anywhere). What is intended? !recommendation (See Summary.) !wording Add after 8.3(18/2): * For an extended_return_statement, the declaration is hidden from all visibility only until the reserved word do of the statement; !discussion Clearly, the intent is that the name is visible in the handled_sequence_of_statements of the extended_return_statement. Any other interpretation about make extended returns pointless. The alternative of changing the syntax is heavier than simply adopting a rule similar to that used for program units. Thus we add an additional bullet to 8.3. --!corrigendum 8.3(18/2) !ACATS Test Any extended return statement test will implicitly check this rule. !appendix !topic Definition of "declaration" is wrong for extended returns !reference RM 3.1(6/2), 6.5, 8.3(16) !from Adam Beneschan 09-12-07 !discussion I believe that 3.1(6/2) is worded incorrectly with respect to extended returns. This makes a difference because of the rule in 8.3(16), "A declaration is hidden from all visibility until the end of the declaration, except..." with some exceptions that don't apply here. In this case: procedure P (I : Integer := I + 1); the declaration is illegal because the declaration of the parameter I is hidden from all visibility until the end of its declaration. The way we know where the declaration ends is from 3.1(6), which says that parameter_specification is defined to be one kind of declaration---and the parameter_specification syntax includes everything up through the default expression, if any. But for an extended return variable, 3.1(6) says that the declaration is the entire extended_return_statement. This would mean that: return X : T do end return; the "end of the declaration" is the "end return;" text, and 8.3(16) would then mean X could not be referred to at all in the !!! Clearly this is not what is intended. I think this will need to be fixed, probably by rearranging 6.5(2.1/3) to say return extended_return_variable_specification [do handled_sequence_of_statements end return]; with extended_return_variable_specification taking care of the syntax that is already there, and then by removing the last sentence of 3.1(6) and adding extended_return_variable_specification to the list. ****************************************************************