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=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.snarked.org!feeder.erje.net!us.feeder.erje.net!feeds.news.ox.ac.uk!news.ox.ac.uk!news.stack.nl!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Generic access type convention and aliasing Date: Wed, 08 May 2013 00:13:23 +0200 Organization: Ada @ Home Message-ID: References: <5a96b4f0-15d3-4fe2-9e9c-000f59b9c864@googlegroups.com> NNTP-Posting-Host: /5uFWkegPs0CGJSoRIUiIw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.15 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 X-Original-Bytes: 3170 Xref: number.nntp.dca.giganews.com comp.lang.ada:181493 Date: 2013-05-08T00:13:23+02:00 List-Id: Le Tue, 07 May 2013 23:03:17 +0200, Jacob Sparre Andersen news = a =C3=A9crit: >> A3 : General_Access :=3D S.Element; -- And the same. > Yes, of course this is legal, but it also includes a dynamic > accessibility check which will fail for this example. (S.Element is mu= ch > shorter lives than type General_Access). So it will raise Program_Erro= r. Right, but I badly wish static check/static failure (may be I want too = much, I believe Ada should have this with the hot area of access value).= > Moreover, the use of access parameters and SAOAATs should be avoided What is =E2=80=9CSAOAATs=E2=80=9D? > unless > you really need dynamic accessibility. What I'm trying to achieve, is to have access to the object storage = designated by the access, while preventing manipulation (including copyi= ng = at any life=E2=80=91time scope) of this access value, only dereference. = The only = way I know to achieve this, is by passing `Element.all` to an = out/in=E2=80=91out/in parameter of a callback, but I would like to avoid= control = inversion (this breaks the flow). I feel there is no way to solve it or I want too much, and I should stop= = searching and go with the storage specific access discriminant (so no = implicit dereference), and use some kind of external static check. At = least storage specific access type offers a tiny bit more protection tha= n = general access, being a discriminant it can't be modified, and being an = = access value, use of a not allocated or deallocated element will be alwa= ys = caught at runtime, even with check disabled=E2=80=A6 the most I can get,= so I will = go with it. -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [1] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [1] [1]: Epigrams on Programming =E2=80=94 Alan J. =E2=80=94 P. Yale Univers= ity