comp.lang.ada
 help / color / mirror / Atom feed
From: Mats.Weber@elca-matrix.ch
Subject: Re: Which compiler is correct?
Date: 1997/06/23
Date: 1997-06-23T00:00:00+00:00	[thread overview]
Message-ID: <867075736.16958@dejanews.com> (raw)
In-Reply-To: EC3tGJ.F0A@world.std.com


In article <EC3tGJ.F0A@world.std.com>,
  bobduff@world.std.com (Robert A Duff) wrote:

> The idea here, is that when you say "type New_Type is new Old_Type ...",
> the properties of New_Type are frozen at that point.  EXCEPT when this
> declaration is inside where Old_Type is declared -- then, at the
> earliest place within New_Type's immediate scope where it can see some
> additional information about Old_Type, then that information becomes
> visible for New_Type.  Usually, this doesn't happen.  When it does
> happen, it's either at the beginning of a private part of a child
> package, or at the beginning of the body of a physically-nested package.

Sorry, but I still don't get it. What is wrong with the following
interpretation of the rules ?

package a is
    type x is tagged private;
private
    type x is tagged record
        i:integer;
    end record;
end a;
package a.b is
    type y is new x with private;

This establishes, among other things, that y inherits x's components.

private
    type y is new x with record
        j:integer;
    end record;
end a.b;
with a.b;
package a.c is
    type z is new a.b.y with private;

As y is visibly derived from x, we know that z is an ancestor of x.

    procedure p;
private

From here on, we have visibility on a's private part, and hence on the
full declaration of x. The "additional characteristic" that y has an i
component becomes visible (because y inherits x's components, and that
fact was already established in y's private declaration).

    type z is new a.b.y with record
        k:integer;
    end record;
end a.c;
package body a.c is
    procedure p is
       one:x;
       two:z;
    begin
        one.i:=1;
        two.k:=2;
        two.i:=3;   -- test_vis.ada: Error: line 31 col 13 LRM:4.1.3(5),
No possible interpretation for selected component i, Ignoring future
references

    end p;
end a.c;

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet




  parent reply	other threads:[~1997-06-23  0:00 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-17  0:00 Which compiler is correct? Tom Moran
1997-06-18  0:00 ` Pascal Obry
1997-06-18  0:00   ` Tom Moran
1997-06-18  0:00 ` Robert A Duff
1997-06-18  0:00   ` John Woodruff
1997-06-19  0:00     ` Robert A Duff
1997-06-20  0:00     ` Jon S Anthony
1997-06-21  0:00       ` Robert A Duff
1997-06-26  0:00         ` Jon S Anthony
1997-06-19  0:00   ` Simon Wright
1997-06-20  0:00     ` Jon S Anthony
1997-06-21  0:00       ` Robert A Duff
1997-06-21  0:00     ` Robert A Duff
1997-06-21  0:00       ` Simon Wright
1997-06-23  0:00       ` Mats.Weber [this message]
1997-06-24  0:00         ` Jon S Anthony
  -- strict thread matches above, loose matches on Subject: below --
1996-09-10  0:00 Which compiler is correct?? Robert B. Love 
1996-09-10  0:00 ` Robert Dewar
1996-09-10  0:00 ` Robert Dewar
1996-09-11  0:00   ` Robert B. Love 
1996-09-11  0:00 ` Jon S Anthony
1996-09-11  0:00 ` Robert A Duff
1996-09-12  0:00   ` Ken Cowan
1996-09-12  0:00   ` Ken Cowan
1996-09-13  0:00   ` Jon S Anthony
1996-09-12  0:00 ` Tucker Taft
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox