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.9 required=5.0 tests=BAYES_00 autolearn=unavailable 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!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Preventing private procedure visibility being made public through extension Date: Sun, 21 May 2017 23:09:57 +0200 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 21 May 2017 21:06:33 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="37fa85fe583f52595e70e5367bc45abb"; logging-data="29292"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/MtAspJ2drAl4lr8K6uJpvH1nkFfpDjx8=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: Cancel-Lock: sha1:9zSSgX63dTPxjNH9MMaVVMzt4Mo= Xref: news.eternal-september.org comp.lang.ada:46843 Date: 2017-05-21T23:09:57+02:00 List-Id: On 05/21/2017 10:21 PM, Jere wrote: > > I just don't > like using access types if I can avoid them. Of course you can avoid them. > So something like: > > type My_Type is tagged limited private; > function Get_Libaray_Component > (Obj : in out My_Type) > return not null access Library_Type; > private > type My_Type is new Other_Library_Type with record > Base : aliased Library_Type; > end record; There are a finite number of operations defined for Library_Type, and, as you said, a smaller number that make sense for your abstraction. So you simply define equivalent operations for My_Type that call the appropriate operations for Library_Type with the Base component. No access types, simple, safe, and clear. -- Jeff Carter "I soiled my armor, I was so scared." Monty Python & the Holy Grail 71