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.36.173.22 with SMTP id c22mr2484196itf.35.1519254486028; Wed, 21 Feb 2018 15:08:06 -0800 (PST) X-Received: by 10.157.113.143 with SMTP id o15mr229555otj.6.1519254485956; Wed, 21 Feb 2018 15:08:05 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!w142no413109ita.0!news-out.google.com!s63ni1376itb.0!nntp.google.com!w142no413108ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 21 Feb 2018 15:08:05 -0800 (PST) In-Reply-To: <6e384796-4a5f-449a-8bf7-3b8fe974b4fc@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=71.171.117.31; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 71.171.117.31 References: <3a2e91d4-f563-4843-9c80-5a76732626d3@googlegroups.com> <6e384796-4a5f-449a-8bf7-3b8fe974b4fc@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <5da1106b-58f5-4d3c-a564-3a530b99042a@googlegroups.com> Subject: Re: non record limited type From: Jere Injection-Date: Wed, 21 Feb 2018 23:08:06 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3857 X-Received-Body-CRC: 4020799175 Xref: reader02.eternal-september.org comp.lang.ada:50528 Date: 2018-02-21T15:08:05-08:00 List-Id: On Wednesday, February 21, 2018 at 5:29:11 PM UTC-5, Mehdi Saada wrote: > > Based on that, your limited private which is really an integer would st= ill be > > a by-copy-type. I don't know the RM's intention but the wording sugges= ts that > > at least. Note you can also used the "aliased" keyword in a function/p= rocedure > > signature to enforce an aliased variable which will be passed by refere= nce > > as well:=20 > > -- Object is passed by reference > > procedure Do_Something(Object : aliased in out Some_Type); >=20 > Really ? Are you sure it "forces" the passing by reference ? But I rememb= er clearly have read somewhere, most probably on this forum that it wasn't = in Ada's philosophy to let one precise that, since it is an implementation = detail, and that the compiler shall decide by himself. The rules are scattered about the RM, but if you look at the Ada2012 Ration= ale document which was released with the RM: =20 http://www.ada-auth.org/standards/rationale12.html You will see it was a new feature added with the Ada2012 revision Section 1.3.3 http://www.ada-auth.org/standards/12rat/html/Rat12-1-3-3.html --------------------- An aliased parameter is always passed by reference and the accessibility=20 rules are modified accordingly. This facility is used in a revision to=20 the containers which avoids the need for expensive and unnecessary copying= =20 of complete elements when they are updated. The details will be given=20 in Sections 4.2 and 6.3. Section 4.2 http://www.ada-auth.org/standards/12rat/html/Rat12-4-2.html --------------------- The other change in Ada 2012 concerning parameters is that they may be=20 explicitly marked aliased thus procedure P(X: aliased in out T; ... ); As a consequence within P we can write X'Access. Recall that tagged types= =20 were always considered implicitly aliased anyway and always passed by=20 reference. If the type T is a by-copy type such as Integer, then adding=20 aliased causes it to be passed by reference. (So by-copy types are not=20 always passed by copy!) Section 6.3 http://www.ada-auth.org/standards/12rat/html/Rat12-6-3.html ---------------------- The alert reader will note the inclusion of aliased for the parameter=20 Container of the function Reference. As discussed in Section 4.2 on=20 subprogram parameters, this ensures that the parameter is passed by=20 reference (it always is for tagged types anyway); it also permits us=20 to apply 'Access to the parameter Container within the function and to=20 return that access value.