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

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

--- ai05s/ai05-0135-1.txt	2009/02/01 08:50:53	1.1
+++ ai05s/ai05-0135-1.txt	2009/02/05 05:27:35	1.2
@@ -792,7 +792,8 @@
     begin
         ...
     exception
-        when Use_Error => ... -- Nope, no good. Have to go back to T_IO as in T_IO.Use_Error. Grrr.
+        when Use_Error => ... -- Nope, no good. Have to go back to T_IO
+                              -- as in T_IO.Use_Error. Grrr.
     end;
 
 ...
@@ -1230,7 +1231,8 @@
 
     with P;
     procedure One is
-        A : P.Vector; -- The selection lets us see entities that are use-all-visible in P, as well as real declarations.
+        A : P.Vector; -- The selection lets us see entities that are
+                      -- use-all-visible in P, as well as real declarations.
     begin
         null;
     end One;
@@ -2113,5 +2115,75 @@
 
 I worry that it might get very messy once you bring "sprouting" into the mix.
 I'll trust you to work that out.
+
+****************************************************************
+
+From: Bob Duff
+Date: Monday, February  2, 2009  2:15 PM
+
+> After all, you make this sound nasty and original; but it already 
+> happens for use clauses and child units, and has since Ada 95 was introduced.
+
+You can come up with similar surprises even in Ada 83.  And with subunits, you
+can make the surprise cross source-file boundaries.  Ada 95 makes it a little
+worse, with child units.
+
+>...We've
+> survived. :-)
+
+I tend to agree with that attitude.  I don't like it, but as you point out,
+we already have similar cases, and we can't fix the whole problem compatibly.
+
+These are really Beaujolais-like effects.  Ichbiah came up with some excellent
+visibility rules for use_clauses, and prevented Beaujolais effects (with a few
+minor bugs, fixed in Ada 95).  But I wonder why he defined "Beaujolais effect"
+purely in terms of use_clauses -- it should be defined more broadly, in terms
+of all visibility-related things.
+
+****************************************************************
+
+From: Robert I. Eachus
+Date: Monday, February  2, 2009  6:28 PM
+
+>You can come up with similar surprises even in Ada 83.  And with 
+>subunits, you can make the surprise cross source-file boundaries.  Ada 
+>95 makes it a little worse, with child units.
+
+Reminds me of a very old gotcha in Ada.  I think I originally wrote it as
+part of a test of compiler overload resolution.  Dave Emery, Rich Hilliard and
+I extracted one case and ran it against Ada compilers on display at a SIGAda
+meeting.  The reaction of almost all who saw their compiler reject it was:
+"That must be a compiler bug--I'll write it up."  We then assured the
+astonished demonstrator that there was no bug their compiler was right to reject
+the program:
+
+procedure Hiding is
+   procedure Foo (X: in Integer := 1) is begin null; end; begin
+   declare
+      procedure Foo is begin null; end;
+   begin
+      Foo;
+   end;
+end Hiding;
+
+The outer Foo can be called by providing an explicit parameter, the inner Foo
+never can.
+
+Is this a bug in Ada that you can declare a subprogram that can't be called?
+Not really, this case is pretty harmless. The case where both subroutines are
+declared in the same scope is similar, and again, a surprise at compile time, but
+relatively harmless. There are variations using use clauses and/or nested packages,
+which were the original purpose of the test, but none of them result in a
+subprogram being totally uncallable.
+
+Why bring this up?  The old joke:
+
+"Doctor, Doctor, it hurts when I do this!"
+"Well, don't do it then."
+
+There are lots of areas in Ada that may be of great interest to language lawyers,
+but which Ada programmers have learned to avoid.  If not because they are bad
+software engineering, because any rocks they run into in those shoals will make
+them look foolish later.
 
 ****************************************************************

Questions? Ask the ACAA Technical Agent