From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Access parameters and accessibility
Date: Tue, 16 Dec 2014 01:45:06 -0600
Date: 2014-12-16T01:45:06-06:00 [thread overview]
Message-ID: <m6onu3$6or$1@loke.gir.dk> (raw)
In-Reply-To: m6n3kr$t51$1@speranza.aioe.org
"Michael B." <michaelb@example.com> wrote in message
news:m6n3kr$t51$1@speranza.aioe.org...
> I'm reading the book "Programming in Ada 2005" of John Barnes and I have
> difficulties to understand the chapter about access parameters.
> In chapter 10.7 on pages 197/198 he writes:
>
> ---
> An access parameter can be passed on to another access parameter;
> typically the accessibility indication is passed on unchanged but in the
> unusual circumstance where the called subprogram is internal to the
> calling subprogram, the accessibility level is replaced by that of the
> (statically known) formal calling parameter if less than the original
> actual parameter.
> ---
>
> Could someone give an example/explanation where this rule is used?
> I tried to read the RM. Chapter 3.10.2 seems to be the right one but I
> don't understand it either...
We in the ARG call discussing accessibility a "trip to the Heart of
Darkness", and indeed, 3.10.2 is now informally called the "Heart of
Darkness". I even put that into an AARM note (3.10.2(3.b/3)). Only the
desperate or foolhardy venture there.
I had heaard about the issue that John mentions in this paragraph, but I
never understood it (I don't think Janus/Ada does it). I've had it explained
to me a couple of times, and I sort of understand it, but you'd have to pay
me to spend an hour finding an example and writing up an appropriate
explanation. It's that draining - I wouldn't do it for free. Sorry.
Besides, I agree with the others that it has nothing to do with OOP. Claw
only uses anonymous access parameters to get the effect of in out parameters
in functions (which isn't a problem with Ada 2012 anyway), and as Dmitry
noted, it doesn't work very well. Anonymous access parameters: just say no!!
Finally, the model that John is talking about isn't sufficient to implement
dynamic accessibility checks in Ada 2005 or Ada 2012. He's really talking
about an implementation short-cut that should be irrelevant to understanding
the feature anyway. (That is, it doesn't even belong in his book.) And that
short-cut doesn't work. Indeed, no Ada compiler has ever actually
implemented correct accessibility checking for Ada 2005 or later. We believe
it is possible (Steve Baird and I have worked out correct implementation
models, but no one has tried either yet). We're supposed to be writing an
Ada-Europe paper -- but of course that requires a trip to the Heart of
Darkness, and neither of us has been in much a hurry to take that trip!
The only thing to worry about vis-a-vis dynamic accessibility checking is
that the object has to have a lifetime the same or longer than the access
type. How that's implemented should not matter (unless of course you are
trying to fix a compiler bug -- something most people here aren't going to
do).
Randy.
next prev parent reply other threads:[~2014-12-16 7:45 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-15 16:52 Access parameters and accessibility Michael B.
2014-12-15 17:54 ` Dmitry A. Kazakov
2014-12-15 18:48 ` Jeffrey Carter
2014-12-15 20:23 ` Michael B.
2014-12-15 21:02 ` Dmitry A. Kazakov
2014-12-16 1:10 ` sbelmont700
2014-12-16 13:57 ` Michael B.
2014-12-16 14:12 ` Georg Bauhaus
2014-12-16 21:34 ` sbelmont700
2014-12-17 14:30 ` Michael B.
2014-12-17 15:41 ` sbelmont700
2014-12-18 17:48 ` Michael B.
2014-12-17 16:03 ` Adam Beneschan
2014-12-18 16:07 ` Michael B.
2014-12-16 7:45 ` Randy Brukardt [this message]
2014-12-16 8:48 ` Stefan.Lucks
2014-12-16 20:47 ` Randy Brukardt
2014-12-16 21:24 ` Georg Bauhaus
2014-12-16 9:08 ` Natasha Kerensikova
2014-12-16 10:00 ` Dmitry A. Kazakov
2014-12-16 14:57 ` Robert A Duff
2014-12-16 19:46 ` Michael B.
2014-12-16 20:59 ` Randy Brukardt
2014-12-17 7:02 ` Natasha Kerensikova
2014-12-17 8:28 ` Dmitry A. Kazakov
2014-12-17 9:06 ` Natasha Kerensikova
2014-12-17 22:58 ` Randy Brukardt
2014-12-17 22:25 ` Randy Brukardt
2014-12-18 0:47 ` Shark8
2014-12-17 2:02 ` Adam Beneschan
2014-12-17 23:18 ` Randy Brukardt
2014-12-18 0:56 ` Robert A Duff
2014-12-18 1:17 ` Randy Brukardt
2014-12-18 5:29 ` Shark8
2014-12-18 23:12 ` Randy Brukardt
2014-12-18 8:27 ` Dmitry A. Kazakov
2014-12-18 21:20 ` Randy Brukardt
2014-12-19 12:16 ` Michael B.
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox