CVS difference for ais/ai-00161.txt

Differences between 1.9 and version 1.10
Log of other versions for file ais/ai-00161.txt

--- ais/ai-00161.txt	2001/10/19 01:36:43	1.9
+++ ais/ai-00161.txt	2002/04/26 20:15:16	1.10
@@ -456,3 +456,59 @@
 
 ****************************************************************
 
+!topic Suggested implementation of Ada.Strings.Unbounded, Preelaborate
+!reference RM95-A.4.5(3), 10.2.1(9); AARM95-A.4.5; Rationale A.2.6
+!from Adam Beneschan 03-29-02
+!discussion
+
+In the AARM, Section A.4.5 (describing Ada.Strings.Unbounded) ends
+with the comment, "A sample implementation of the private part of the
+package and several of the subprograms appears in the Rationale."
+
+The package defines a constant Null_Unbounded_String.  In the
+Rationale, section A.2.6 (see http://www.adaic.org/standards/95rat/
+RAThtml/rat95-p3-a.html#2), the suggested implementation defines the
+constant this way, in the private part:
+
+    Null_Unbounded_String : constant Unbounded_String :=
+      (Controlled with Reference => Null_String'Access);
+
+where Controlled is Ada.Finalization.Controlled.
+
+However, it appears to me that this suggestion is illegal.
+RM95-A.4.5(3) says that Ada.Strings.Unbounded has a Preelaborate
+pragma, which means it must be preelaborable, which means, according
+to 10.2.1(9), that the elaboration of the package must not evaluate an
+extension_aggregate with an ancestor subtype_mark denoting a subtype
+of a controlled type.  The above constant declaration violates this
+rule.  (3.4.1(10) defines a type to be a descendant of itself, and
+Ada.Finalization.Controlled is a controlled type by 7.6(9).)
+
+Is my interpretation incorrect?  It seems strange to me that an
+implementation which is suggested by an official document (and also
+seems to be the natural way to implement the constant) should be
+illegal.
+
+****************************************************************
+
+From: 	Pascal Leroy
+Sent: 	Saturday, March 30, 2002  2:30 AM
+
+This is a problem that has been known for about 8 years and is addressed by
+AI 161.  I guess the folks who wrote the Rationale didn't have, at the time,
+a full-fledged Ada compiler to check the code examples.
+
+****************************************************************
+
+From: 	Robert Dewar
+Sent: 	Saturday, March 30, 2002  8:04 AM
+
+Indeed this problem is well known :-)
+
+What we do in GNAT is to use the illegal code as given, but then we have a
+special kludge in the compiler to allow this for internal implementation
+units (there is no rule in the RM that requires library packages to be
+written in Ada :-)
+
+****************************************************************
+

Questions? Ask the ACAA Technical Agent