CVS difference for ais/ai-00360.txt

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

--- ais/ai-00360.txt	2005/04/13 05:37:18	1.10
+++ ais/ai-00360.txt	2005/10/31 05:18:37	1.11
@@ -307,3 +307,55 @@
 one updated by TC1.
 
 ****************************************************************
+
+From: Christoph Grein
+Sent: Friday, September 16, 2005  10:26 AM
+
+I do not understand the following sentences occurring at many places:
+
+XXX is defined to need finalization. If the restriction No_Nested_Finalization
+(see D.7) applies to the partition, and XXX does not have a controlled part,
+it will not be allowed in local objects in Ada 2005 whereas it would be allowed
+in Ada 95. Such code is not portable, as another Ada compiler may have a
+controlled part in XXX, and thus would be illegal.
+
+Shouldn't it be:
+
+If the restriction No_Nested_Finalization (see D.7) applies to the partition,
+and XXX has a controlled part, ...
+
+****************************************************************
+
+From: Randy Brukardt
+Sent: Friday, September 16, 2005  6:34 PM
+
+No. As the comment says, that would make the application of the pragma (and
+thus the legality of the program) dependent on the precise implementation of
+the type. We don't want that, so we've introduced the concept of "needs
+finalization" and applied it to various language-defined types. (Perhaps
+there should also be a pragma to declare that for user-defined types, but
+that's another issue.) A type that "needs finalization" is one that *might*
+reasonably be implemented with a controlled part (thus type Integer doesn't
+need finalization). In general, we don't want the legality of programs to
+depend on what's in private parts, and that applies to restrictions as much
+as anything else. (It's not practical to do that for all restrictions, but
+it does make sense to insure that the language-defined types operate the
+same way for every implementation.)
+
+To take a specific example, the type Text_IO.File_Type is defined to "need
+finalization". Thus, the pragma No_Nested_Finalization applies to local
+objects of that type, whether or not the type actually uses a controlled
+part. For instance, Janus/Ada's implementation of File_Type (derived from
+our Ada 83 implementation) doesn't use a controlled part (although it
+logically does the same sort of things). Thus, in Ada 95, you could declare
+a local object of Text_IO.File_Type even when the No_Nested_Finalization
+restriction is enforce. But it's perfectly reasonable for some other
+implementation to use a controlled type for this implementation, in which
+case the program would be illegal. We want programs using the
+language-defined types to remain portable, and thus we want a common
+treatment.
+
+See AI-360 (as indexed from every one of the paragraphs you referenced) for
+a longer discussion of this issue.
+
+****************************************************************

Questions? Ask the ACAA Technical Agent