CVS difference for ai05s/ai05-0147-1.txt

Differences between 1.2 and version 1.3
Log of other versions for file ai05s/ai05-0147-1.txt

--- ai05s/ai05-0147-1.txt	2009/03/15 03:48:09	1.2
+++ ai05s/ai05-0147-1.txt	2009/07/11 03:06:22	1.3
@@ -1,4 +1,4 @@
-!standard 4.4 (07)                                09-03-14  AI05-0147-1/02
+!standard 4.4 (07)                                09-06-27  AI05-0147-1/03
 !standard 4.5.7 (0)
 !standard 4.7(2)
 !standard 4.7(3)
@@ -51,7 +51,7 @@
 A conditional expression would make writing this expression easy:
 
          subtype Calculation_Range is Natural range 0 ..
-             (if N=0 then 10_000 else 10_000 / N)) + 1;
+             (if N=0 then 10_000 else 10_000 / N) + 1;
 
 
 The pending addition of preconditions to Ada will greatly increase this
@@ -61,7 +61,22 @@
 but this sacrifices a lot of readability, when what is actually meant is
    Precondition => (if Param_1 >= 0 then Param_2 /= "" else True)
 
-For both of these reasons, we are proposing to add conditional expressions
+
+Another situation is renaming an object determined at runtime:
+
+     procedure S (A, B : Some_Type) is
+         Working_Object : Some_Type renames
+            (if Some_Func(A) then A else B);
+     begin
+         -- Use Working_Object in a large chunk of code.
+     end S;
+
+In Ada currently, you would have to either duplicate the working code (a bad
+idea if it is large) or make the working code into a subprogram (which adds
+overhead, and would complicate the use of exit and return control structures).
+
+
+For all of these reasons, we are proposing to add conditional expressions
 to Ada.
 
 !proposal
@@ -171,6 +186,16 @@
 I don't think this level of detail is common enough to add to the language, but
 the rewrite of this paragraph would make it easy to add here if desired.]
 
+** TBD: We need wording to deal with built-in-place issues. In particular, a
+conditional expression ought to work like a set of parens rather than an aggregate
+with one component: no temporary object would be created (even logically).
+
+** TBD: We also need to deal with the case that the various results have mixed
+tagged states: if one result is statically tagged and another is dynamically tagged,
+and the whole is used as the argument of a non-dispatching call, probably we need
+something to be illegal (we wouldn't want this to be a way to avoid 3.9.2(8-9)).
+[Well, I might, but that's a different issue. ;-)]
+
 
 !discussion
 
@@ -219,7 +244,7 @@
 the declarations:
 
    procedure Q (A, B : Integer);
-   procedure Q (A, B : float);
+   procedure Q (A, B : Float);
 
    function F return Integer;
    function F return Boolean;
@@ -227,7 +252,7 @@
    function G (N : Natural) return Integer;
    function G (N : Natural) return Float;
 
-   Q (if X > 3 then F else G(1)), (if X > 12 then G(2) else G(3)));
+   Q ((if X > 3 then F else G(1)), (if X > 12 then G(2) else G(3)));
 
 If we used full resolution, this would resolve to Integer because there is no F
 for Float. With the unlimited number of terms available in a conditional

Questions? Ask the ACAA Technical Agent