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!mx02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Access parameters and accessibility Date: Tue, 16 Dec 2014 01:45:06 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1418715907 6939 24.196.82.226 (16 Dec 2014 07:45:07 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 16 Dec 2014 07:45:07 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:24032 Date: 2014-12-16T01:45:06-06:00 List-Id: "Michael B." 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.