CVS difference for ais/ai-10318.txt
--- ais/ai-10318.txt 2005/10/31 05:18:48 1.15
+++ ais/ai-10318.txt 2005/12/15 02:44:24 1.16
@@ -1,5 +1,6 @@
-!standard 03.10.02(10) 05-09-20 AI95-00318-02/11
+!standard 03.10.02(10) 05-12-09 AI95-00318-02/12
!standard 03.10.02(13)
+!standard 03.01(06)
!standard 03.08(14)
!standard 03.09(24)
!standard 04.03.03(11)
@@ -129,17 +130,17 @@
An extended syntax for the return statement is proposed:
- RETURN identifier : [ALIASED] return_subtype_indication [:= expression] [DO
+ RETURN defining_identifier : [ALIASED] return_subtype_indication [:= expression] [DO
handled_sequence_of_statements
END RETURN];
Such an extended return statement is permitted only immediately within a
-function. The specified identifier names the object that is the result of
-a call on the function. If the expression is present, it provides
+function. The specified defined_identifier names the object that is the
+result of a call on the function. If the expression is present, it provides
the initial value for the result object. If not, the result object
is default initialized. If the handled_sequence_of_statements is
present, it is executed after initializing the result object. Within
-the handled_sequence_of_statements, the identifier denotes a variable
+the handled_sequence_of_statements, the defining_identifier denotes a variable
view of the result object with nominal subtype given by the subtype_indication.
When the handled_sequence_of_statements completes, the function is complete.
@@ -178,6 +179,11 @@
!wording
+Add at the end of 3.1(6):
+
+In addition, an extended_return_statement is a declaration of its
+defining_identifier.
+
Add before 3.8(14):
If a record_type_declaration includes the reserved word limited, the type
@@ -266,7 +272,7 @@
simple_return_statement ::= return [expression];
extended_return_statement ::=
- RETURN identifier : [ALIASED] return_subtype_indication [:= expression] [DO
+ RETURN defining_identifier : [ALIASED] return_subtype_indication [:= expression] [DO
handled_sequence_of_statements
END RETURN];
@@ -327,7 +333,7 @@
Static Semantics
Within an extended_return_statement, the *return object* is declared with
- the given identifier, with the nominal subtype defined by the
+ the given defining_identifier, with the nominal subtype defined by the
return_subtype_indication.
Dynamic Semantics
@@ -739,6 +745,27 @@
for aggregates, we included such a requirement in the Corrigendum.
+!corrigendum 3.1(6)
+
+@drepl
+Each of the following is defined to be a declaration: any @fa<basic_declaration>;
+an @fa<enumeration_literal_specification>; a @fa<discriminant_specification>;
+a @fa<component_declaration>; a @fa<loop_parameter_specification>;
+a @fa<parameter_specification>; a @fa<subprogram_body>;
+an @fa<entry_declaration>; an @fa<entry_index_specification>;
+a @fa<choice_parameter_specification>;
+a @fa<generic_formal_parameter_declaration>.
+@dby
+Each of the following is defined to be a declaration: any @fa<basic_declaration>;
+an @fa<enumeration_literal_specification>; a @fa<discriminant_specification>;
+a @fa<component_declaration>; a @fa<loop_parameter_specification>;
+a @fa<parameter_specification>; a @fa<subprogram_body>;
+an @fa<entry_declaration>; an @fa<entry_index_specification>;
+a @fa<choice_parameter_specification>;
+a @fa<generic_formal_parameter_declaration>.
+In addition, an @fa<extended_return_statement> is a declaration of its
+@fa<defining_identifier>.
+
!corrigendum 3.8(14)
@dinsb
@@ -972,7 +999,7 @@
@xcode<@fa<simple_return_statement ::= >@ft<@b<return>>@fa< [expression];>>
@xcode<@fa<extended_return_statement ::=
- >@ft<@b<return>>@fa< identifier : [>@ft<@b<aliased>>@fa<] return_subtype_indication [:= expression] [>@ft<@b<do>>@fa<
+ >@ft<@b<return>>@fa< defining_identifier : [>@ft<@b<aliased>>@fa<] return_subtype_indication [:= expression] [>@ft<@b<do>>@fa<
handled_sequence_of_statements
>@ft<@b<end return>>@fa<];>>
@@ -1050,8 +1077,8 @@
@i<@s8<Static Semantics>>
Within an @fa<extended_return_statement>, the @i<return object> is declared
-with the given identifier, with the nominal subtype defined by the
-@fa<return_subtype_indication>.
+with the given @fa<defining_identifier>, with the nominal subtype defined by
+the @fa<return_subtype_indication>.
!corrigendum 6.5(06)
@@ -3852,6 +3879,100 @@
D meets the letter of the old rule, but shouldn't be included if L is actually
completed by Integer (say).
+
+****************************************************************
+
+From: Sergey I. Rybin
+Sent: Friday, December 2, 2005 1:29 PM
+
+!topic question about the definition of extended_return_statement syntax
+!reference RM06-6.5(2.1/2)
+!from Sergey Rybin 2005-12-02
+!keywords extended_return_statement, identifier, defining identifier
+!discussion
+
+RM06-6.5(2.1/2) defines the syntax of extended_return_statement as:
+
+ extended_return_statement ::=
+ return identifier : [aliased] return_subtype_indication [:= expression] [do
+ ^^^^^^^^^^
+ handled_sequence_of_statements
+ end return];
+
+The question is about the use of the identifier notion.
+
+ From one side, the construct
+
+ identifier : [aliased] return_subtype_indication [:= expression]
+
+looks exactly as a declaration, except that it uses 'identifier', but not
+'DEFINING_identifier'. Moreover, RM06-6.5(5.7/2) says:
+
+ Within an extended_return_statement, the return object is declared
+ ^^^^^^^^^^^
+ with the given identifier, with the nominal subtype defined by
+ the return_subtype_indication.
+
+But in all the other cases, if something "is declared", then the corresponding
+syntax construct contains 'defining_identifier', but not 'identifier'!
+
+This looks confusing, and I've got really confused by this situation trying
+to analyze how the existing ASIS Standard should be extended for Ada 2005.
+
+So, in my opinion, either 'identifier' should be replaced with 'defining_identifier'
+here (and the corresponding note should be added to that part of RM06-3.1 that
+discusses various forms of declarations), or RM06-6.5 should explicitly explain
+why it uses 'identifier' in the syntax structure of extended_return_statement
+
+And as an ASIS person, I'm pretty sure that the definition of extended_return_statement
+syntax structure should use 'defining_identifier', but not 'identifier'
+
+****************************************************************
+
+From: Randy Brukardt
+Sent: Friday, December 2, 2005 2:16 PM
+
+...
+> So, in my opinion, either 'identifier' should be replaced with
+> 'defining_identifier' here (and the corresponding note should be
+> added to that part of RM06-3.1 that
+> discusses various forms of declarations), or RM06-6.5 should
+> explicitly explain
+> why it uses 'identifier' in the syntax structure of
+> extended_return_statement
+
+My initial reaction to this was "what's a defining_identifier"? Which might
+explain the syntax. :-)
+
+The closest correllary to extended return is for loops (that is, a statement
+that declares something), and it uses "defining_identifier". So I think you
+are right. But I'd like to hear from Tucker if there is some subtle reason
+for this difference, or if he, like me, just plain forgot about
+"defining_identifier".
+
+****************************************************************
+
+From: Gary Dismukes
+Sent: Friday, December 2, 2005 2:17 PM
+
+This looks like an oversight to me. It certainly seems that this should
+be a defining_identifier.
+
+****************************************************************
+
+From: Tucker Taft
+Sent: Friday, December 2, 2005 3:08 PM
+
+I agree. defining_identifier is the right syntactic construct.
+
+****************************************************************
+
+From: Robert A. Duff
+Sent: Friday, December 2, 2005 4:30 PM
+
+Yes. I suspect there are dozens of rules that apply to defining_identifiers
+(and defining names, which are defined in terms of defining_identifiers), and
+that _should_ apply to these return objects.
****************************************************************
Questions? Ask the ACAA Technical Agent