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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5dacec64c8c879fa X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.73.229 with SMTP id o5mr11791187pbv.7.1328553250309; Mon, 06 Feb 2012 10:34:10 -0800 (PST) Path: lh20ni267690pbb.0!nntp.google.com!news2.google.com!postnews.google.com!b23g2000yqn.googlegroups.com!not-for-mail From: AdaMagica Newsgroups: comp.lang.ada Subject: Re: Preventing Unchecked_Deallocation? Date: Mon, 6 Feb 2012 10:34:09 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <33a35da4-6c3e-4ab4-b58f-a9d73565d79a@t30g2000vbx.googlegroups.com> <4350713b-6ac3-4b22-b221-8da2bac52fea@t5g2000yqk.googlegroups.com> NNTP-Posting-Host: 91.7.74.107 Mime-Version: 1.0 X-Trace: posting.google.com 1328553250 31407 127.0.0.1 (6 Feb 2012 18:34:10 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 6 Feb 2012 18:34:10 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: b23g2000yqn.googlegroups.com; posting-host=91.7.74.107; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALENKRC X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.0; rv:10.0) Gecko/20100101 Firefox/10.0,gzip(gfe) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-02-06T10:34:09-08:00 List-Id: On 6 Feb., 17:21, Adam Beneschan wrote: > > When you say erroneous, do you mean forbidden by the language (i.e. an > > exception) or that it will cause undefined operation? Unpredictable behaviour (generally not an exception). > I think the solution is not to expose the access type, but have your > package define a private type. =A0Ada 2012 is supposed to have new > mechanisms that allow packages to define "dereference" operations that > could allow package users to use the same kind of syntax on objects of > private types that they can use on access types. =A0If you do this, then > it's likely that the package that defines the type can control what > operations are available and not make Unchecked_Deallocation > available. =A0However, I haven't yet studied the new feature so I can't > say for sure. See e.g. http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai05s/ai05-0268-1.txt?r= ev=3D1.3 and http://www.adacore.com/2011/06/06/gem-107-preventing-deallocation-for-r= eference-counted-types/ A further gem will eventually be published with more details about implicit dereferencing and indexing.