CVS difference for ais/ai-00382.txt

Differences between 1.6 and version 1.7
Log of other versions for file ais/ai-00382.txt

--- ais/ai-00382.txt	2005/08/05 04:37:13	1.6
+++ ais/ai-00382.txt	2006/01/10 22:17:50	1.7
@@ -164,4 +164,130 @@
 
 !appendix
 
+From: Tucker Taft
+Sent: Monday, January  2, 2006  9:25 PM
+
+Here is another comment that comes from reviewing
+John's book.  I think John may have noted the same
+thing himself.  It seems like the current instance
+rule for naming the current instance of a type shouldn't
+apply in contexts where a subtype name is required.
+We made a special exception for "access T",
+but "new T" seems like another case, as does "T'(...)".
+One of John's examples bumps into the "new T" case
+in a task type that is creating new instances of the
+task type on the fly.
+
 ****************************************************************
+
+From: Jean-Pierre Rosen
+Sent: Tuesday, January  3, 2006  7:19 AM
+
+Doesn't seem so necessary. In most cases, you can get around the current
+instance rule by declaring a subtype. This would obviously not be
+possible inside the type definition itself, but works everywhere else.
+
+****************************************************************
+
+From: Tucker Taft
+Sent: Tuesday, January  3, 2006  7:48 AM
+
+Here is an example where you might want the allocator
+inside the type declaration:
+
+     type Tree(Is_Leaf : Boolean := True) is record
+       case Is_Leaf is
+         when True =>
+           Val : Integer := 0;
+         when False =>
+           Left : not null access Tree := new Tree;  -- illegal
+           Right : not null access Tree := new Tree; -- illegal
+       end case;
+     end record;
+
+****************************************************************
+
+From: Randy Brukardt
+Sent: Tuesday, January  3, 2006  3:18 PM
+
+That looks pretty dubious to me; there would be no way to recover the
+storage for these allocators, so they would be a potential storage leak.
+
+For instance, if you wrote:
+
+        Obj : not null access Tree := new Tree(Is_Leaf => False);
+
+there would be no way to recover the Left and Right objects. [Anonymous
+access types can't be used to instantiation Unchecked_Deallocation - ED]
+(They're not co-extensions, and they could be changed to other values
+anyway, so they couldn't be freed with the outer object.)
+
+"not null" components aren't likely to be used a lot because of issues like
+this; usually you need a way to represent "no item", and null is perfect for
+that. And when you don't need that, they need an existing item to point at
+for initialization - meaning that they can't usefully be used in recursive
+situations.
+
+****************************************************************
+
+From: Tucker Taft
+Sent: Tuesday, January  3, 2006  3:52 PM
+
+I suspect I could create more convincing examples.
+I chose to use anonymous non-null access values, but
+I could have used named access types, and I might
+still want a component in one variant to be default
+initialized with an allocator for some other variant.
+
+Not being able to recover the storage is not always
+relevant, since there is a class of programs that
+builds up a data structure and uses it, but never
+reclaims it before the program ends.
+
+In any case, it seems a bit odd to allow the use of
+"access T" inside of T but not "new T".  I should
+reiterate I see this as something to consider for
+post Ada 2005.
+
+****************************************************************
+
+From: Pascal Leroy
+Sent: Wednesday, January  4, 2006  3:15 AM
+
+Now that we allow subtypes of incomplete types, it seems to me that the
+following is legal:
+
+     type Tree;
+     subtype T is Tree;
+     type Tree(Is_Leaf : Boolean := True) is record
+       case Is_Leaf is
+         when True =>
+           Val : Integer := 0;
+         when False =>
+           Left : not null access Tree := new T;  -- OK?
+           Right : not null access Tree := new T; -- OK?
+       end case;
+     end record;
+
+If this works, it is actually quite similar to the trick you have to use
+for task types.
+
+****************************************************************
+
+From: Pascal Leroy
+Sent: Wednesday, January  4, 2006  3:55 AM
+
+Note that if you changed the current instance rule for allocators and
+qualified expressions, you would end up with rather cryptic expressions
+like:
+
+	new T (T.Disc)
+	T'(T)
+
+where the first T is a subtype name and the second T an object name (the
+current instance).  Also, the meaning of something like T'Size (subtype
+size or current instance size?) would become rather unclear to the reader,
+even if well-defined in the RM.
+
+****************************************************************
+

Questions? Ask the ACAA Technical Agent