CVS difference for ais/ai-00150.txt

Differences between 1.6 and version 1.7
Log of other versions for file ais/ai-00150.txt

--- ais/ai-00150.txt	1999/09/24 03:27:05	1.6
+++ ais/ai-00150.txt	1999/10/08 23:41:05	1.7
@@ -1,4 +1,4 @@
-!standard 08.03    (26)                               99-09-15  AI95-00150/06
+!standard 08.03    (26)                               99-10-07  AI95-00150/07
 !class binding interpretation 96-09-04
 !status Corrigendum 2000 99-08-13
 !status WG9 approved 98-06-12
@@ -14,9 +14,8 @@
 
 !summary
 
-For a type extension declared in a child package, where the parent type
-is declared in an ancestor package, it is illegal for the two types to
-have duplicate component names.
+A type extension is illegal if somewhere with its immediate scope it has two
+visible components with the same name.
 
 !question
 
@@ -84,6 +83,30 @@
 in a child of Parent, then the two Y's would be legal, since there would
 be no place where both are visible.
 
+This problem can occur anytime components can become visible after the initial
+declaration. Consider:
+
+  package A is
+      type Foo is tagged private;
+      package B is
+          type New_Foo is new Foo with record
+             I: Integer; -- Illegal because Foo.I is visible in the body.
+          end record; -- Foo.I is not visible here.
+      end C;
+  private
+      type Foo is  tagged record  I: Integer; end record;
+  end A;
+
+  package body A is
+      package body B is
+          -- Foo.I becomes visible here, but that means we have two components
+          -- with the same name visible in same record.
+      end C;
+  end B;
+
+Because of this, the new rule simply says that it is illegal for two components
+with the same name to ever be visible.
+
 !corrigendum 8.03(26)
 
 @drepl
@@ -103,10 +126,9 @@
 An explicit declaration is illegal if there is a homograph occurring
 immediately within the same declarative region that is visible at the place
 of the declaration, and is not hidden from all visibility by the explicit
-declaration. In addition, in a type extension of a type declared in an ancestor
-package, a component declaration is illegal if two components, both visible in
-the private part of the child, are homographs. Similarly, the
-@fa<context_clause> for a @fa<subunit> is illegal if it mentions (in a
+declaration. In addition, a type extension is illegal if somewhere within
+its immediate scope it has two visible components with the same name. Similarly,
+the @fa<context_clause> for a @fa<subunit> is illegal if it mentions (in a
 @fa<with_clause>) some library unit, and there is a homograph of the library
 unit that is visible at the place of the corresponding stub, and the homograph
 and the mentioned library unit are both declared immediately within the same
@@ -265,5 +287,41 @@
      end record;
 end B.C;
 }
+
+****************************************************************
+
+From: Randy Brukardt
+Sent: October 7, 1999
+
+At the recent ARG meeting, it was pointed out that components can become
+visible in the body in certain cases.
+
+For example:
+
+  package A is
+      type Foo is tagged private;
+  private
+      type Foo is  tagged record  I: Integer; end record;
+  end A;
+
+  package A.B is
+      type New_Foo is new A.Foo with private;
+      package C is
+          type Newer_Foo is new New_Foo with record
+             I: Integer; -- Illegal because A.Foo.I is visible in the body.
+             J: Integer; -- Illegal because New_Foo.J is visible in the body.
+          end record;
+      end C;
+  private
+      type New_Foo is new A.Foo with record J: Integer; end record;
+  end B;
+
+  package body A.B is
+      package body C is
+          -- A.Foo.I and New_Foo.J become visible here.
+      end C;
+  end B;
+
+This requires a broader rule.
 
 ****************************************************************

Questions? Ask the ACAA Technical Agent