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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.unit0.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Mart van de Wege Newsgroups: comp.lang.ada Subject: Re: Can't access record attribute in derived type Date: Wed, 08 Mar 2017 22:06:12 +0100 Message-ID: <86a88v4gxn.fsf@gaheris.avalon.lan> References: <86mvcv4zyu.fsf@gaheris.avalon.lan> Mime-Version: 1.0 Content-Type: text/plain X-Trace: individual.net iykjnP0PrPW40wtns94OXAepCpxWE2EZVUYGKqrb2yRVbwcIFl X-Orig-Path: gaheris.avalon.lan!not-for-mail Cancel-Lock: sha1:1OlbCe6+R+BYI/6HB/6q3Bsl7qI= sha1:PZSIyd+2dS07JjayErdjc0QT+QE= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Xref: news.eternal-september.org comp.lang.ada:33498 Date: 2017-03-08T22:06:12+01:00 List-Id: "Randy Brukardt" writes: > I suspect we'll need to see a more complete example to definitively say what > the problem is. > > But if I had to guess, I'd suggest that you've run afoul of the "sibling > inheritance problem". The rule for visibility for child components is that > *all* of components of the *all* of the ancestors have to be visible at the > point of declaration of the child type. If even one of the ancestors is not > visible (as happens when deriving from a type defined in a sibling child > package), then the components aren't visible, either. > > Note that in such a case, if you have visiblity on some but not all of the > ancestors, you can type convert the object to make them visible. In your > example above: > > return Creature(K).Parents.First_Element; > > will work if you have some intermediate ancestor without visible components. > So, if the above works, you have a sibling inheritance problem, and your > choices are either to use conversions like the above, or move the types so > that all of the ancestors are visible. > > Randy. > > > -- "We will need a longer wall when the revolution comes." --- AJS, quoting an uncertain source.