CVS difference for ai05s/ai05-0028-1.txt
--- ai05s/ai05-0028-1.txt 2006/12/16 03:13:19 1.2
+++ ai05s/ai05-0028-1.txt 2007/01/13 05:25:56 1.3
@@ -1,4 +1,5 @@
-!standard 10.2.1(10.1/2) 06-12-14 AI05-0028-1/02
+!standard 10.2.1(9/2) 07-01-12 AI05-0028-1/03
+!standard 10.2.1(10.1/2)
!standard 10.2.1(11.4/2)
!standard 10.2.1(11.8/2)
!class binding interpretation 06-11-13
@@ -65,6 +66,26 @@
with a generic that is legal but cannot be instantiated, which is
obnoxious.
+7 - Ada 2005 dropped the "default initialized object" part of 10.2.1(9/2),
+because it was thought that it couldn't matter. Consider this example
+from text BA21002.A (case k):
+
+ type Tag is tagged record
+ C : My_Int := Func;
+ D : Integer;
+ end record;
+ ...
+
+ Tag1 : constant BA21002_0.Tag := (0, 10); -- OK.
+ -- Declaration of a constant (j) (k).
+
+Type Tag does not have preelaborable initialization (because of the default
+expression). So 10.2.1(9/2) says that object Tag1 is illegal. But that
+is a nasty incompatibility with Ada 95, which (as the test shows) allowed
+this declaration.
+
+Was this incompatibility intended? (No.)
+
!recommendation
(See Summary.)
@@ -73,6 +94,12 @@
TBD.
+For question 7, replace the first sentence of 10.2.1(9/2) with:
+
+ The creation of an object that is initialized by default of a type
+ that does not have preelaborable initialization.
+
+
!discussion
TBD.
@@ -226,6 +253,107 @@
> Maybe a novice question.
No comment. ;-)
+
+****************************************************************
+
+From: Randy Brukardt
+Date: Friday, January 12, 2007 1:32 PM
+
+We dropped the "default initialized object" part of 10.2.1(9/2), because we
+thought that it couldn't matter. I think we were wrong. Consider this example
+from text BA21002.A (case k):
+
+ type Tag is tagged record
+ C : My_Int := Func;
+ D : Integer;
+ end record;
+ ...
+
+ Tag1 : constant BA21002_0.Tag := (0, 10); -- OK.
+ -- Declaration of a constant (j) (k).
+
+Type Tag does not have preelaborable initialization (because of the default
+expression). So 10.2.1(9/2) says that object Tag1 is illegal.
+
+But that's a nasty incompatibility with Ada 95 (as shown by this example),
+and there is no problem so long as the reason that type Tag does not have
+PInit is simply because of its default expressions (or its component types
+default expressions, ad nausum).
+
+I think we have to put back the "default initialized" wording. That would also
+cover <> in aggregates, the only way to write something other than default
+initialization for these sorts of types as a whole. The only alternative to
+that is to have two kinds of PInit, which sounds like heading down a rabbit hole
+to me.
+
+What do you think?
+
+****************************************************************
+
+From: Tucker Taft
+Date: Friday, January 12, 2007 2:27 PM
+
+I agree, 10.2.1(9/2) should say:
+
+ ... the creation of a default-initialized object (including
+ a component) of a type that does not have preelaborable
+ initialization.
+
+Or something like that. If you look at the wording in
+10.2.1(11.3/2) there is similar wording, and perhaps we
+should just use that as a model. We clearly realized that
+default initialization was critical when deciding whether
+a component was preelaborable, so it makes sense to have
+the same criteria for deciding whether an object is
+preelaborable.
+
+So this is a corrigendum bug, I guess.
+
+****************************************************************
+
+From: Randy Brukardt
+Date: Friday, January 12, 2007 2:54 PM
+
+> I agree, 10.2.1(9/2) should say:
+>
+> ... the creation of a default-initialized object (including
+> a component) of a type that does not have preelaborable
+> initialization.
+>
+> Or something like that.
+
+Well, it should include the new technical term initialized by default
+(which covers cases in allocators and aggregates as well). That wasn't done
+in the past 'cause there was no such term. But we surely want this to apply
+to aggregates and allocators.
+
+I also don't think we need the component wording: it's covered by the
+component rules for preelaborable initialization (PInit). That is, if
+there is a component that doesn't have PInit, then the type containing it
+cannot have PInit, either. That is part of the Ada 95 text that was moved
+to (11.1-11.5/2), but was left here for no reason.
+
+ ... the creation of an object that is initialized by default of a type
+ that does not have preelaborable initialization.
+
+> If you look at the wording in
+> 10.2.1(11.3/2) there is similar wording, and perhaps we
+> should just use that as a model. We clearly realized that
+> default initialization was critical when deciding whether
+> a component was preelaborable, so it makes sense to have
+> the same criteria for deciding whether an object is
+> preelaborable.
+
+Yes, and it makes even more sense because the wording was there in Ada 95, but
+someone convinced us we didn't need it. That often happens because we didn't
+understand all of the ramifications; it's always iffy to remove existing wording
+"because we don't need it".
+
+> So this is a corrigendum bug, I guess.
+
+Yes. I think we should just add it to AI05-0028, which is already discussing
+various preelaborable initialization bugs. I especially like that because that
+AI is not assigned to me, so I'll just add the question and get out of the way. ;-)
****************************************************************
Questions? Ask the ACAA Technical Agent