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!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Preventing private procedure visibility being made public through extension Date: Mon, 22 May 2017 10:52:40 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <4a47e4cd-829c-4451-abf1-82cf60b67706@googlegroups.com> <9cdf04e6-123e-4bd9-b466-77aad00d61bb@googlegroups.com> <1cb79ede-c4ec-4a37-b6c7-4ca45bc76cf1@googlegroups.com> NNTP-Posting-Host: vZYCW951TbFitc4GdEwQJg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Language: en-US Xref: news.eternal-september.org comp.lang.ada:46850 Date: 2017-05-22T10:52:40+02:00 List-Id: On 22/05/2017 00:28, Jere wrote: > If Get_Access is returning not null access Base.Base_Type, what > prevents someone from doing: > > type My_Base_Access is access all Base.Base_Type; > > Ptr : My_Base_Access; > > and then > > Ptr := Some_Variable.Get_Access; > > I know you said anonymous access types are difficult to copy, > but the small example I tried in GNAT GPL 2016 allows such > a copy. Is this a compiler bug? If not, I think I misunderstood. You can always defeat accessibility checks this or other way. Why should anybody declaring an extra access type? You could also create an instance of Unchecked_Deallocation on My_Base_Access and then free a stack allocated object... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de