CVS difference for ais/ai-10318.txt
--- ais/ai-10318.txt 2005/06/16 23:47:48 1.13
+++ ais/ai-10318.txt 2005/08/21 06:00:44 1.14
@@ -1,4 +1,4 @@
-!standard 03.10.02(10) 05-05-16 AI95-00318-02/09
+!standard 03.10.02(10) 05-07-11 AI95-00318-02/10
!standard 03.10.02(13)
!standard 03.08(14)
!standard 03.09(24)
@@ -40,6 +40,7 @@
!standard 07.05(02)
!standard 07.05(08)
!standard 07.05(09)
+!standard 07.05(23)
!standard 07.06(17.1)
!standard 07.06.01(02)
!standard 07.06.01(18)
@@ -294,27 +295,30 @@
it applies to a function body. An extended_return_statement shall apply to
a function body.
- If the result subtype of a function is defined by a subtype_mark, the
- return_subtype_indication of an extended_return_statement that applies to
- the function body shall be a subtype_indication. The type of the
- subtype_indication shall be the result type of the function. If the result
- subtype of the function is constrained, then the subtype defined by the
- subtype_indication shall also be constrained and shall statically match
- this result subtype. If the result subtype of the function is
- unconstrained, then the subtype defined by the subtype_indication shall be
- a definite subtype, or there shall be an expression.
-
- If the result subtype of the function is defined by an access_definition,
- the return_subtype_indication shall be an access_definition. The subtype
- defined by the access_definition shall statically match the result subtype
- of the function. The accessibility level of this anonymous access subtype
- is that of the result subtype.
-
- If the result subtype of the function is limited, then the expression of the
- return statement (if any) shall be an aggregate, a function call (or
- equivalent use of an operator), or a qualified_expression or parenthesized
- expression whose operand is one of these.
+ For an extended_return_statement that applies to a function body:
+ * If the result subtype of the function is defined by a subtype_mark, the
+ return_subtype_indication shall be a subtype_indication. The type of the
+ subtype_indication shall be the result type of the function. If the
+ result subtype of the function is constrained, then the subtype defined
+ by the subtype_indication shall also be constrained and shall statically
+ match this result subtype. If the result subtype of the function is
+ unconstrained, then the subtype defined by the subtype_indication shall
+ be a definite subtype, or there shall be an expression.
+
+ * If the result subtype of the function is defined by an
+ access_definition, the return_subtype_indication shall be an
+ access_definition. The subtype defined by the access_definition shall
+ statically match the result subtype of the function. The accessibility
+ level of this anonymous access subtype is that of the result subtype.
+
+ For any return statement that applies to a function body:
+
+ * If the result subtype of the function is limited, then the expression of
+ the return statement (if any) shall be an aggregate, a function call (or
+ equivalent use of an operator), or a qualified_expression or
+ parenthesized expression whose operand is one of these.
+
AARM Note:
In other words, if limited, the expression must produce a
"new" object, rather than being the name of a preexisting object
@@ -331,39 +335,47 @@
For the execution of an extended_return_statement, the subtype_indication
or access_definition is elaborated. This creates the nominal subtype of the
return object. If there is an expression, it is evaluated and
- converted to the nominal subtype (which might raise Constraint_Error -- see 4.6)
- and becomes the initial value of the return object; otherwise, the return
- object is initialized by default as for a stand-alone object of its nominal
- subtype (see 3.3.1). If the nominal subtype is indefinite, the return
- object is constrained by its initial value. The handled_sequence_of_statements,
- if any, is then executed.
+ converted to the nominal subtype (which might raise Constraint_Error --
+ see 4.6), and the converted value is assigned to the return object.
+ Otherwise, the return object is initialized by default as for a stand-alone
+ object of its nominal subtype (see 3.3.1). If the nominal subtype is
+ indefinite, the return object is constrained by its initial value.
For the execution of a simple_return_statement, the expression (if any) is
- first evaluated and converted to the result subtype to become the value of
+ first evaluated, converted to the result subtype, and then assigned to
the anonymous *return object*.
If the result type of a function is a specific tagged type, the
- tag of the return object is that of the result type.
+ tag of the return object is that of the result type. If the result type
+ is class-wide, the tag of the return object is that of the value of
+ the expression.
AARM Ramification:
- This is true even if the tag of the expression is different, which
- could happen if the expression were a view conversion or a
- dereference of an access value. Note that for a limited type, because
+ The first sentence is true even if the tag of the expression is
+ different, which could happen if the expression were a view conversion or
+ a dereference of an access value. Note that for a limited type, because
of the restriction to aggregates and function calls (and no conversions),
the tag will already match.
AARM Reason:
- This rule ensures that a function whose result type is a specific tagged
- type always returns an object whose tag is that of the result type. This
- is important for dispatching on controlling result, and allows the caller
- to allocate the appropriate amount of space to hold the value being
- returned (assuming there are no discriminants).
-
+ The first rule ensures that a function whose result type is a specific
+ tagged type always returns an object whose tag is that of the result
+ type. This is important for dispatching on controlling result, and allows
+ the caller to allocate the appropriate amount of space to hold the value
+ being returned (assuming there are no discriminants).
+
+
+ For the execution of an extended_return_statement, the
+ handled_sequence_of_statements is executed. Within this
+ handled_sequence_of_statements, the execution of a simple_return_statement
+ that applies to the extended_return_statement causes a transfer of control
+ that completes the extended_return_statement. Upon completion of a return
+ statement that applies to a callable construct, a transfer of control is
+ performed which completes the execution of the callable construct, and
+ returns to the caller.
- Finally, a transfer of control is performed which completes the
- execution of the construct to which the return statement applies,
- and returns to the caller. In the case of a function, the
- function_call denotes a constant view of the return object.
+ In the case of a function, the function_call denotes a constant view
+ of the return object.
Examples
@@ -398,11 +410,18 @@
Similarly, the replacement note of 7.5(9)
of AI-287 should say "aggregate or function_call" in each occurrence.
+Replace 7.5(23) by:
+
+The fact that the full view of File_Name is explicitly declared limited
+means that parameter passing will always be by reference and function
+results will always be built directly in the result object (see 6.2 and
+6.5).
+
+
Replace 7.6(17.1) with:
For an aggregate of a controlled type whose value is assigned, other than by an
-assignment_statement or a simple_return_statement of a return type with no part
-that is of a task, protected, or explicitly limited record type, the
+assignment_statement, the
implementation shall not create a separate anonymous object for the aggregate.
The aggregate value shall be constructed directly in the target of the
assignment operation and Adjust is not called on the target object.
@@ -1001,27 +1020,32 @@
@fa<simple_return_statement> shall include an @fa<expression> if and only if
it applies to a function body. An @fa<extended_return_statement> shall apply to
a function body.
+
+For an extended_return_statement that applies to a function body:
-If the result subtype of a function is defined by a @fa<subtype_mark>, the
-@fa<return_subtype_indication> of an @fa<extended_return_statement> that
-applies to the function body shall be a @fa<subtype_indication>. The type of
-the @fa<subtype_indication> shall be the result type of the function. If the
-result subtype of the function is constrained, then the subtype defined by the
-@fa<subtype_indication> shall also be constrained and shall statically match
-this result subtype. If the result subtype of the function is unconstrained,
-then the subtype defined by the @fa<subtype_indication> shall be a definite
-subtype, or there shall be an @fa<expression>.
-
-If the result subtype of the function is defined by an @fa<access_definition>,
-the @fa<return_subtype_indication> shall be an @fa<access_definition>. The
-subtype defined by the @fa<access_definition> shall statically match the result
-subtype of the function. The accessibility level of this anonymous access
-subtype is that of the result subtype.
-
-If the result subtype of the function is limited, then the @fa<expression>
-of the return statement (if any) shall be an @fa<aggregate>, a function call
-(or equivalent use of an operator), or a @fa<qualified_expression> or
-parenthesized expression whose operand is one of these.
+@xbullet<If the result subtype of the function is defined by a
+@fa<subtype_mark>, the @fa<return_subtype_indication> shall be a
+@fa<subtype_indication>. The type of the @fa<subtype_indication> shall be the
+result type of the function. If the result subtype of the function is
+constrained, then the subtype defined by the @fa<subtype_indication> shall also
+be constrained and shall statically match this result subtype. If the result
+subtype of the function is unconstrained, then the subtype defined by the
+@fa<subtype_indication> shall be a definite subtype, or there shall be an
+@fa<expression>.>
+
+@xbullet<If the result subtype of the function is defined by an
+@fa<access_definition>, the @fa<return_subtype_indication> shall be an
+@fa<access_definition>. The subtype defined by the @fa<access_definition> shall
+statically match the result subtype of the function. The accessibility level of
+this anonymous access subtype is that of the result subtype.>
+
+For any return statement that applies to a function body:
+
+@xbullet<If the result subtype of the function is limited, then the
+@fa<expression> of the return statement (if any) shall be an @fa<aggregate>, a
+function call (or equivalent use of an operator), or a
+@fa<qualified_expression> or parenthesized expression whose operand is one of
+these.>
@i<@s8<Static Semantics>>
@@ -1039,16 +1063,16 @@
@fa<subtype_indication> or @fa<access_definition> is elaborated. This creates
the nominal subtype of the return object. If there is an @fa<expression>,
it is evaluated and converted
-to the nominal subtype (which might raise Constraint_Error -- see 4.6) and
-becomes the initial value of the return object; otherwise, the return object is
+to the nominal subtype (which might raise Constraint_Error -- see 4.6) and then
+the converted value becomes the initial value of the return object.
+Otherwise, the return object is
initialized by default as for a stand-alone object of its nominal subtype
(see 3.3.1). If the nominal subtype is indefinite, the return object is
-constrained by its initial value. The @fa<handled_sequence_of_statements>, if
-any, is then executed.
+constrained by its initial value.
For the execution of a @fa<simple_return_statement>, the @fa<expression>
-(if any) is first evaluated and converted to the result subtype to become
-the value of the anonymous @i<return object>.
+(if any) is first evaluated, converted to the result subtype, and then
+assigned to the anonymous @i<return object>.
!corrigendum 6.5(07)
@@ -1062,7 +1086,12 @@
If the result type is a specific tagged type:
@dby
If the result type of a function is a specific tagged type, the
-tag of the return object is that of the result type.
+tag of the return object is that of the result type. If the result type
+is class-wide, the tag of the return object is that of the value of
+the expression. A check is made that the accessibility
+level of the type identified by the tag of the result is not deeper than
+that of the master that elaborated the function body. If this check fails,
+Program_Error is raised.
!corrigendum 6.5(09)
@@ -1149,10 +1178,17 @@
execution of the callable construct to which the @fa<return_statement> applies,
and returns to the caller.
@dby
-Finally, a transfer of control is performed which completes the
-execution of the construct to which the return statement applies,
-and returns to the caller. In the case of a function, the
-@fa<function_call> denotes a constant view of the return object.
+For the execution of an @fa<extended_return_statement>, the
+@fa<handled_sequence_of_statements> is executed. Within this
+@fa<handled_sequence_of_statements>, the execution of a
+@fa<simple_return_statement> that applies to the @fa<extended_return_statement>
+causes a transfer of control that completes the @fa<extended_return_statement>.
+Upon completion of a return statement that applies to a callable construct, a
+transfer of control is performed which completes the execution of the callable
+construct, and returns to the caller.
+
+In the case of a function, the @fa<function_call> denotes a constant view of
+the return object.
!corrigendum 6.5(24)
@@ -1235,6 +1271,18 @@
assignment operation must be a @fa<function_call>, and such @fa<function_call>s
must be built directly in the target object.>>
+!corrigendum 7.5(23)
+
+@drepl
+@xindent<@s9<The fact that the full view of File_Name is explicitly declared
+@key[limited] means that parameter passing and function return will always be
+by reference (see 6.2 and 6.5).>>
+@dby
+@xindent<@s9<The fact that the full view of File_Name is explicitly declared
+limited means that parameter passing will always be by reference and function
+results will always be built directly in the result object (see 6.2 and
+6.5).>>
+
!corrigendum 7.6(17.1)
@drepl
@@ -1246,9 +1294,7 @@
not called on the target object.
@dby
For an @fa<aggregate> of a controlled type whose value is assigned,
-other than by an @fa<assignment_statement> or a
-@fa<simple_return_statement> of a return type with no part that is of a task,
-protected, or explicitly limited record type, the implementation shall not
+other than by an @fa<assignment_statement>, the implementation shall not
create a separate
anonymous object for the @fa<aggregate>. The aggregate value shall be
constructed directly in the target of the assignment operation and Adjust is
Questions? Ask the ACAA Technical Agent