From: "Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr>
Subject: Re: Generic access type convention and aliasing
Date: Wed, 08 May 2013 00:13:23 +0200
Date: 2013-05-08T00:13:23+02:00 [thread overview]
Message-ID: <op.wwqiolpeule2fv@cardamome> (raw)
In-Reply-To: kmbq6m$mf7$1@loke.gir.dk
Le Tue, 07 May 2013 23:03:17 +0200, Jacob Sparre Andersen news
<randy@rrsoftware.com> a écrit:
>> A3 : General_Access := 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 much
> shorter lives than type General_Access). So it will raise Program_Error.
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 “SAOAATs”?
> 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 copying
at any life‑time scope) of this access value, only dereference. The only
way I know to achieve this, is by passing `Element.all` to an
out/in‑out/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 than
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 always
caught at runtime, even with check disabled… the most I can get, so I will
go with it.
--
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University
next prev parent reply other threads:[~2013-05-07 22:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-06 0:20 Generic access type convention and aliasing Yannick Duchêne (Hibou57)
2013-05-06 5:55 ` Yannick Duchêne (Hibou57)
2013-05-07 0:56 ` Randy Brukardt
2013-05-07 6:02 ` Yannick Duchêne (Hibou57)
2013-05-07 6:42 ` Yannick Duchêne (Hibou57)
2013-05-07 17:34 ` AdaMagica
2013-05-07 19:08 ` Yannick Duchêne (Hibou57)
2013-05-07 21:03 ` Jacob Sparre Andersen news
2013-05-07 22:13 ` Yannick Duchêne (Hibou57) [this message]
2013-05-08 11:28 ` Yannick Duchêne (Hibou57)
2013-05-08 20:44 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox