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.182.232.227 with SMTP id tr3mr26392779obc.14.1420385657640; Sun, 04 Jan 2015 07:34:17 -0800 (PST) X-Received: by 10.140.93.226 with SMTP id d89mr4552qge.13.1420385657616; Sun, 04 Jan 2015 07:34:17 -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!feeder.erje.net!eu.feeder.erje.net!news.glorb.com!h15no21009024igd.0!news-out.google.com!n9ni76qai.0!nntp.google.com!dc16no4048137qab.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 4 Jan 2015 07:34:17 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=206.53.78.59; posting-account=ShYTIAoAAABytvcS76ZrG9GdaV-nXYKy NNTP-Posting-Host: 206.53.78.59 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <28b172d1-7116-4c01-ae5e-4d3ebf2e5c30@googlegroups.com> Subject: Re: How to use read-only variables? From: sbelmont700@gmail.com Injection-Date: Sun, 04 Jan 2015 15:34:17 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:24341 Date: 2015-01-04T07:34:17-08:00 List-Id: On Sunday, January 4, 2015 7:56:42 AM UTC-5, hreba wrote: >=20 > Fourth, in what practical cases do you really use 'access const' for=20 > read-only variables; I thought my case a pretty typical one? >=20 A similar solution would be to have a function returning an 'access const' = to the value, instead of the value itself, which replaces the return-by-ref= erence mechanism (e.g. for when the value is not just an integer, but some = other 'stateful' object). Another common pattern you'll see is to return a= null record with a single access discriminant to the value in order to con= trol some of the lifetime considerations. -sb