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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,fa22a73e140a6fd1 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.129.169 with SMTP id nx9mr3596119pbb.8.1326054750354; Sun, 08 Jan 2012 12:32:30 -0800 (PST) Path: lh20ni157410pbb.0!nntp.google.com!news1.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!news.musoftware.de!wum.musoftware.de!feeder.erje.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 08 Jan 2012 14:32:29 -0600 User-Agent: NewsTap/3.5.1 (iPad) From: Martin Dowie Newsgroups: comp.lang.ada Mime-Version: 1.0 Message-ID: <1867838491347747324.347214martin-re.mo.ve.thedowies.com@news.btinternet.com> Subject: Re: Object-Oriented style question References: <4f098fcb$0$6577$9b4e6d93@newsspool3.arcor-online.net> Date: Sun, 08 Jan 2012 14:32:29 -0600 X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-REPNsE2s1LcuDle7Axbf8Fs1m/ovhwDWLLJiK5N+d1W4VFVDacrVqjuITj7KlCFgtGyIxKYSbojzBIP!ZbzS3Tr+VPlfTBCcV/MVyOJnbKqRu91fOKRB6QIGPkC8yE2Gy2JrZmcBoLXZF5Ab8/sy+QLAHG7D!FFDwskZyXaFoijr/7s6Z1zE7rMs0YVjuex8hUEI2Q3ldzLJk X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2656 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: 2012-01-08T14:32:29-06:00 List-Id: Robert A Duff wrote: > Georg Bauhaus writes: > >> function Info (Item : in T) return Value; > > This is the right way to do it. Don't use access types when > you don't need to. That goes double for anonymous access > types, and triple for cases involving run-time accessibility > checks, as the cases below do. > > I can't think of any good reason to use access parameters > in Ada. Note: "access parameter" does not mean "parameter of > an access type", it means "parameter of an ANONYMOUS access type". > > The "in" is just noise; I suggest you leave it out. > >> function Info_1 (Item_Doubly_Indirect : access T) return Value; >> function Info_2 (Item_Doubly_Indirect : access constant T) return Value; >> function Info_3 (Item_Doubly_Indirect : not null access constant T) return Value; > > All of the above exclude null. That is, "not null" is implicit > for Info_1 and Info_2. Calling any of these three with "null" > will raise Constraint_Error. That's necessary, because they're > dispatching on a Tag, and if the actual is null, there is no tag. > > So Info_2 and Info_3 have identical semantics. > > - Bob Presumably when you need to store a reference to an object, you'd then pass in a 'aliased in out' and take an '(Unchecked_)Access? This is how I map a UML association to Ada. -- Martin -- -- Sent from my iPad