From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1cd7fdac64d4639b X-Google-Attributes: gid103376,public From: Tucker Taft Subject: Re: losing visibility Date: 2000/10/24 Message-ID: <39F5F1CA.AC29AF5B@averstar.com>#1/1 X-Deja-AN: 685386192 Content-Transfer-Encoding: 7bit References: X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@inmet2.burl.averstar.com X-Trace: inmet2.burl.averstar.com 972419530 8320 141.199.8.77 (24 Oct 2000 20:32:10 GMT) Organization: AverStar (formerly Intermetrics) Burlington, MA USA Mime-Version: 1.0 NNTP-Posting-Date: 24 Oct 2000 20:32:10 GMT Newsgroups: comp.lang.ada Date: 2000-10-24T20:32:10+00:00 List-Id: tmoran@bix.com wrote: > > Would someone please refresh my memory as to why "nucleus" should > become invisible in: Because grandkid is declared outside the immediate scope of "child," it inherits only operations that are visible outside of child. The fact that the body of package four knows more about the parent of "child" is irrelevant. It doesn't have visibility on the nucleus field of child, and grandkid doesn't inherit visibility on the nucleus field. The first paragraph of 7.3.1 is the key one, and here is the key sentence: ... Such private operations are available only inside the declarative region of the package or generic package. ".nucleus" is a private operation on child, and it is not visible outside of package three, because it is not available until after the word "private" (when the full type of the parent becomes visible). -Tucker Taft ------------------------- > > package one is > type root is tagged private; > private > type root is tagged record > nucleus : integer; > end record; > end one; > > package one.two is > package three is > type child is new one.root with private; > private > type child is new one.root with record > electrons : integer; > end record; > end three; > > package four is > type grandkid is new three.child with null record; > procedure initialize(x : in out grandkid); > end four; > > end one.Two; > > package body one.Two is > package body four is > procedure initialize(x : in out grandkid) is > begin > x.nucleus := 1; -- <<<<<<<<<<<<<< BAD nucleus not visible > end initialize; > end four; > > y : four.grandkid; > > begin > one.root(y).nucleus := 2; -- <<<<<<<<<<<<<< OK, nucleus visible > y.nucleus := 3; -- <<<<<<<<<<<<<< BAD, nucleus not visible > > end one.Two; > > with one.Two; > procedure testvis is > begin null;end testvis; -- -Tucker Taft stt@averstar.com http://www.averstar.com/~stt/ Technical Director, Commercial Division, AverStar (formerly Intermetrics) (http://www.averstar.com/services/IT_consulting.html) Burlington, MA USA