comp.lang.ada
 help / color / mirror / Atom feed
* Re: Ada 95 visibility question
@ 1997-09-25  0:00 Chris Sparks (Mr. Ada)
  1997-09-25  0:00 ` Bruce Link
  1997-09-26  0:00 ` Robert A Duff
  0 siblings, 2 replies; 6+ messages in thread
From: Chris Sparks (Mr. Ada) @ 1997-09-25  0:00 UTC (permalink / raw)



Robert A Duff <bobduff@WORLD.STD.COM> wrote:

> >package body c.f is
> >  procedure p(x:in out file_dialog) is
> >    y:integer;
> >  begin
> >    y:=root(x).peek_a_boo;
> >    y:=x.peek_a_boo;  1/3 of compilers tested complained
>
> This is illegal.  Dialog has a peek_a_boo component implicitly declared
> in the private part of c.d.  There is no place within the immediate
> scope of file_dialog where this private part is visible, so file_dialog
> doesn't declare peek_a_boo.  (It's still there at run time, but you can
> only get at it by doing a type conversion, as shown above.)

Wouldn't peek_a_boo be visible since the types are part of the "c" (no
pun
intended) hierarchy?

Chris Sparks




^ permalink raw reply	[flat|nested] 6+ messages in thread
* Ada 95 visibility question
@ 1997-09-20  0:00 Tom Moran
  1997-09-22  0:00 ` Robert A Duff
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Moran @ 1997-09-20  0:00 UTC (permalink / raw)



Of three compilers I tried this on, 2 took it happily and one said it
couldn't find such a thing as "peek_a_boo" at the place indicated. 
What's correct?
package c is
  type root is tagged private;
private
  type root is tagged record
    peek_a_boo:integer;
  end record;
end c;

package c.d is
  type dialog is new c.root with private;
private
  type dialog is new c.root with record
    dd:integer;
  end record;
end c.d;

with c.d;
package c.f is
  type file_dialog is new c.d.dialog with private;
  procedure p(x:in out file_dialog);
private
  type file_dialog is new c.d.dialog with record
    ff:integer;
  end record;
end c.f;

package body c.f is
  procedure p(x:in out file_dialog) is
    y:integer;
  begin
    y:=root(x).peek_a_boo;
    y:=x.peek_a_boo;  1/3 of compilers tested complained
  end p;
end c.f;

with c.f;
procedure bug1 is
  f:c.f.file_dialog;
begin
  c.f.p(f);
end bug1;





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1997-09-26  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-09-25  0:00 Ada 95 visibility question Chris Sparks (Mr. Ada)
1997-09-25  0:00 ` Bruce Link
1997-09-25  0:00   ` Tucker Taft
1997-09-26  0:00 ` Robert A Duff
  -- strict thread matches above, loose matches on Subject: below --
1997-09-20  0:00 Tom Moran
1997-09-22  0:00 ` Robert A Duff

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