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 X-Received: by 10.50.79.169 with SMTP id k9mr5067582igx.5.1418781758700; Tue, 16 Dec 2014 18:02:38 -0800 (PST) X-Received: by 10.50.132.71 with SMTP id os7mr123204igb.11.1418781758402; Tue, 16 Dec 2014 18:02:38 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!h15no23538886igd.0!news-out.google.com!h6ni99igv.0!nntp.google.com!h15no23538885igd.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 16 Dec 2014 18:02:37 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=KSa2aQoAAACOxnC0usBJYX8NE3x3a1Xq NNTP-Posting-Host: 66.126.103.122 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Access parameters and accessibility From: Adam Beneschan Injection-Date: Wed, 17 Dec 2014 02:02:38 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3369 X-Received-Body-CRC: 2280897272 Xref: news.eternal-september.org comp.lang.ada:24062 Date: 2014-12-16T18:02:37-08:00 List-Id: On Tuesday, December 16, 2014 11:46:59 AM UTC-8, Michael B. wrote: > > Besides, I agree with the others that it has nothing to do with OOP. Cl= aw > > only uses anonymous access parameters to get the effect of in out param= eters > > in functions (which isn't a problem with Ada 2012 anyway), and as Dmitr= y > > noted, it doesn't work very well. Anonymous access parameters: just say= no!! >=20 > How can I avoid them when they are heavily used in so many libraries? > E.g. GtkAda: I just looked into some arbitrary .ads files from Gnat GPL= =20 > 2014 (glib-string.ads, glib-object.ads and gdk-event.ads) and found=20 > examples of the usage of anonymous access parameters. > You could argue that this is bad design, but rewriting all this code is= =20 > not really an option for me. > And compared to writing GUIs in plain C it seems to be the lesser of two= =20 > evils. I don't see how it could be a problem if you *use* a subprogram that requir= es an anonymous access parameter. You can pretty much just pass in an obje= ct of any matching named access type, or 'Access (or 'Unchecked_Access) of = a matching object. You don't need to create any new anonymous access types= in order to do so. I'm sure Randy was being tongue-in-cheek when he said "get better libraries= ". For one thing, you'd have to get better libraries than the libraries Ad= a provides, because Ada defines some subprograms with anonymous access para= meters--namely Ada.Tags.Generic_Dispatching_Constructor, Ada.Execution_Time= .Timers.Timer, and Read|Write_Exception_Occurrence in Ada.Exceptions. Also= , the stream attribute subprograms ('Read, 'Write, etc.) all have anonymous= access parameters, and you have to *write* a subprogram that has an anonym= ous access parameter in order to use it as the stream subprogram for a type= . Quelle horreur! Anyway, I think you can avoid defining new subprograms = that take anonymous access parameters (except where needed for streams, or = for Generic_Dispatching_Constructor) and not add to the problem, but I don'= t see any value in avoiding existing libraries. -- Adam