CVS difference for ais/ai-00162.txt

Differences between 1.4 and version 1.5
Log of other versions for file ais/ai-00162.txt

--- ais/ai-00162.txt	2003/12/07 05:00:29	1.4
+++ ais/ai-00162.txt	2004/01/23 04:59:23	1.5
@@ -1,4 +1,4 @@
-!standard 03.10.02 (13)                               03-12-01  AI95-00162/03
+!standard 03.10.02 (13)                               04-01-12  AI95-00162/04
 !class binding interpretation 96-09-10
 !status work item 98-10-02
 !status received 96-09-10
@@ -9,11 +9,13 @@
 
 !summary
 
-A new kind of master is defined for objects associated with the evaluation of
-an allocator of an anonymous type, a function call, or an aggregate. The
-enclosing statement or declaration is the master of these anonymous objects.
-Finalization, task dependence, accessibility levels, and lifetimes for these
-objects are all defined in terms of this master.
+More entities are defined to be masters in order to handle objects associated
+with the evaluation of an allocator of an anonymous type, a function call, or
+an aggregate. The enclosing statement or declaration is typically the master of
+these anonymous objects. Finalization, task dependence, accessibility levels,
+and lifetimes for these objects are all defined in terms of this master.
+Finalization, task dependence, accessibility levels, and lifetimes for other
+objects remain unchanged.
 
 !question
 
@@ -80,11 +82,12 @@
      in terms of *accessibility levels*, which reflect the run-time nesting
      of *masters* (see 7.6.1).
 
-In 3.10.2(7), replace "enclosing master" with "enclosing unrestricted master".
+In 3.10.2(7), replace "innermost enclosing master" with
+"innermost enclosing master other than the declaration itself".
 
 Delete the second sentence of 3.10.2(13).
 
-In 6.5(18), replace "master" with "unrestricted master".
+In 6.5(18) replace "not deeper than" with "not deeper than or equal to".
 
 In 7.6.1(3), replace
 
@@ -93,56 +96,55 @@
 
 with
 
-   ".. except in the case of a *master*. An *unrestricted master* is
-   the execution of a task_body, a block_statement, a subprogram_body,
-   an entry_body, or an accept_statement. A *restricted master*
-   is the execution of a statement, declaration, pragma, or
-   entry_barrier condition which is not an unrestricted master.
+   ".. except in the case of a *master*: the execution of a task_body,
+   a block_statement, a subprogram_body, an entry_body, an accept_statement,
+   a simple_statement, a declarative_item which does not declare a package,
+   a pragma, a condition, the expression of a case statement,
+   a loop_parameter_specification, the entry_index of an accept_statement,
+   a delay_expression, or a generic_association (including an implicit
+   generic_association associated with a defaulted generic parameter - see
+   12.3)."
 
 Replace 7.6.1(13/1 - 13.1/1) with
 
-  A restricted master is a master of any anonymous object created as part of
-  its execution by the evaluation of an allocator of an anonymous access type,
-  a function call, or an aggregate except if the object is
-
-    - created as part of the execution of a more nested restricted master;
-
-    - created as part of a rename declaration which renames any part of the
-      object. In this case, the nearest enclosing unrestricted master of the
-      rename declaration is defined to be a master of the object; the
-      accessibility level of the object is defined to be the accessibility
-      level of this master.
-
-  or
-
-    - created by an allocator of an anonymous access type which is used to
-      initialize an access discriminant of another object. In this case, the
-      masters of the allocated object are defined to be masters of the
-      discriminated object; the accessibility level of the allocated object
-      is defined to be that of the discriminated object.
+  The accessibility level of an anonymous object created as part of
+  the evaluation of an allocator of an anonymous access type,
+  a function call, or an aggregate is the accessibility level of the
+  innermost enclosing master except in the following cases:
+
+    - If the object is created as part of a rename declaration which renames
+      any part of the object, then the accessibility level of the object
+      is defined to be the accessibility level of the innermost master
+      enclosing the rename declaration.
+
+    - If the object is created by an allocator of an anonymous access type
+      which is used to initialize an access discriminant of another object,
+      then the accessibility level of the allocated
+      object is defined to be that of the discriminated object.
       The allocated object is finalized when the discriminated object is
       finalized. The storage occupied by the allocated object is deallocated
       when the storage occupied by the discriminated object is deallocated.
 
-  For a statement, the finalization of such an anonymous object occurs
-      - when the statement is completed;
-  or
-      - immediately before beginning the execution of a nested statement;
-  or
-      - in the case of a potentially blocking operation, immediately before
-        the operation blocks the current task
-  , whichever occurs first. Otherwise, this finalization occurs when the entity
-  is completed.
-
-  The accessibility level of the anonymous object is the accessibility
-  level of this master.
-
-
-In 9.3(2), replace "master" with "unrestricted master".
-In 9.3(3), replace "master" with "unrestricted master".
-In 13.11(18), replace "master" with "unrestricted master".
+  In the case of a potentially blocking operation which is a master,
+  finalization of these anonymous objects occurs before the operation
+  blocks the current task. In the case of an expression which is a master,
+  finalization of these anonymous objects occurs as the final part of
+  evaluation of the expression.
+
+In 9.3(2) replace
+    "each master that includes the elaboration of the declaration of the
+     ultimate ancestor of the given access type"
+ with
+    "each master that includes the elaboration of the declaration of the
+     ultimate ancestor of the given access type other than the declaration
+     itself".
+
+In 9.3(3) replace
+    "each master that includes this elaboration"
+ with
+    "each master that includes this elaboration other than the declaration
+     itself".
 
-
 Add at the end of 13.11.2(17).
 
   If the object being reclaimed has an access discriminant which designates
@@ -166,11 +168,10 @@
 The Solution
 ------------
 
-A new master is defined for objects associated with the evaluation of an
-allocator of an anonymous type, a function call, or an aggregate. For these
-objects only, the enclosing statement or declaration acts as a master.
-Finalization, task dependence, accessibility levels, and lifetimes for these
-objects are all defined in terms of this master.
+More entities are defined to be masters. These new masters have no effect on
+objects declared via a declaration (e.g. they do not affect the accessibility
+level of such an object), but only act as masters for these objects which
+previously lacked well-defined masters.
 
 This is not an incompatible change. This AI defines the run-time behavior
 of constructs whose behavior was previously undefined, but is otherwise
@@ -240,6 +241,7 @@
 
 Open Issues
 -----------
+
 None have been identified.
 
 Technical Notes
@@ -251,21 +253,7 @@
               Task_Vector (1 .. Function_Call_Requiring_Finalization.Field);
 
    , the declaration is the master of the function result object but is
-   not the master of the tasks. This declaration, like every declaration,
-   is now a master, but 9.3(3) now refers to "unrestricted masters" and the
-   declaration is a "restricted master".
-
-   The distinction between two kinds of masters (tentatively called
-   "unrestricted" and "restricted") is necessary because some places
-   in the manual need to refer to *all* masters (e.g. the discussion in
-   7.6.1(4) of the finalization of a master or the definition in
-   3.10.2(6) of the accessibility level of a master) while other places
-   need to refer only to old-style (i.e. unrestricted) masters (e.g. 3.10.2(7)
-   and 9.3(3)). An earlier (uncirculated) version of this AI attempted to
-   simply use the term "master" in both cases, but this didn't work well.
-
-   The terms "unrestricted master" and "restricted master" are not themselves
-   very satisfactory. Does anyone have a better alternative?
+   not the master of the tasks because of the change to 3.10.2(7).
 
 2) It seems somewhat odd that
      X : Some_Access_Type := new T1 (Access_Discrim => new T2);
@@ -306,48 +294,59 @@
    for a generic formal IN OUT parameter in a generic_instantiation, so no
    description of the dynamic semantics of this case was ever needed.
 
-8) A compound statement which acts as a master need not be treated as though it
-   encloses any other master for purposes of determining accessibility levels.
-   In this example
-       while Function_Call_Requiring_Finalization.Field loop
-         declare
-           X : Some_Type;
-         begin
-           null;
-         end;
-       end loop;
-   , an implementation may choose to view the master of X as being at a deeper
-   accessibility level than the master of the function call or not; it doesn't
-   matter.
-
-9) Instead of defining compound statements to be masters, another approach
-   would be to define conditions, selector expressions for case statements,
-   loop parameter specifications, delay_expressions, etc. to be masters.
-   This would eliminate the need for the special treatment of entry_barrier
-   conditions.
-
-10) The discussion section of AI-169 mentions problems stemming from
-    "an anonymous object which is not associated with any particular master".
-    Such an anonymous object now has a master.
+8) The discussion section of AI-169 mentions problems stemming from
+   "an anonymous object which is not associated with any particular master".
+   Such an anonymous object now has a master.
+
+9) In this example
+       function Dereference (X : access Some_Task_Type) return Task_Type is
+       begin
+          returns X.all;
+       end;
+
+       Y : Task_Type renames Dereference (new Task_Type);
+   , the attempt to return X.all now raises Program_Error because
+   of the change to 6.5(18). This is a good thing, as this would be
+   very difficult to implement otherwise. The behavior of this example
+   was previously unclear.
+
+10) In this example
+       delay Function_Call_Requiring_Finalization.Field;
+    , the function call is finalized before, not after, the task delays.
+
+11) A compound_statement is not a master. Instead, any expression whose
+    nearest enclosing statement/declaration/pragma/expression is a
+    compound_statement is a master. In this example
+         if Function_Call_Requiring_Finalization.Field then
+             declare
+                 X : My_Task_Type;
+             begin
+                 null;
+             end;
+         end if;
+    , the if_statement is not a master. Instead, the condition is a master.
+    This means that finalization of any objects associated with the
+    compound_statement occurs before, not after, the execution of any nested
+    statements. Similarly, in this example
+         for I in 1 .. Function_Call_Requiring_Finalization.Field loop
+           Foo;
+         end loop;
+    , the function result is finalized before calling Foo.
+
+12) In this example
+        declare
+            generic
+            package G is
+                X : Some_Task_Type;
+            end G;
 
-11) In this example
-        function Dereference (X : access Some_Task_Type) return Task_Type is
+            package I is new G (Function_Call_Requiring_Finalization);
+            Y : Some_Task_Type;
         begin
-           returns X.all;
+            null;
         end;
-
-        Y : Task_Type renames Dereference (new Task_Type);
-    , the attempt to return X.all now raises Program_Error because
-    of the change to 6.5(18). This is a good thing, as this would be
-    very difficult to implement otherwise. The behavior of this example
-    was previously unclear.
-
-12) The execution of a block_statement is an unrestricted master, not a
-    restricted master.
-
-13) We refer to "the master" of an object only in informal discussion.
-    A precise definition of this term would be straightforward, but
-    so far it has not been necessary for RM wording.
+    , the function result object has a deeper accessibility level than the two
+    tasks (which have the same accessibility level).
 
 --!corrigendum
 

Questions? Ask the ACAA Technical Agent