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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:a6b:ef12:: with SMTP id k18-v6mr5016005ioh.31.1531610933642; Sat, 14 Jul 2018 16:28:53 -0700 (PDT) X-Received: by 2002:aca:eb15:: with SMTP id j21-v6mr2427863oih.6.1531610933451; Sat, 14 Jul 2018 16:28:53 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!d7-v6no3888460itj.0!news-out.google.com!l67-v6ni4136itl.0!nntp.google.com!g2-v6no3881287itf.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 14 Jul 2018 16:28:53 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=71.171.111.51; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 71.171.111.51 References: <40d568da-4715-42de-8e28-98da39a5c974@googlegroups.com> <7742818a-8789-4a0d-b420-e170a89dcf5e@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <0bd84a0c-26db-4b80-b99a-9235d70f67ae@googlegroups.com> Subject: Re: Visibility of Indexing aspects From: Jere Injection-Date: Sat, 14 Jul 2018 23:28:53 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:53822 Date: 2018-07-14T16:28:53-07:00 List-Id: On Saturday, July 14, 2018 at 7:00:36 PM UTC-4, Shark8 wrote: > On Saturday, July 14, 2018 at 12:29:44 PM UTC-6, Jere wrote: > > > > There was no mention of being able to index the type (publicly), so it > > surprised me that a client using the package could call the index > > operation. If it was intentional, then that was fine, I just wanted to > > know because I couldn't find anything in the RM that forbid it, but I > > might have missed something. > > You do raise a good point though WRT to visibility; it *would* be more consistent with Ada to have a distinction between (eg) publicly indexable and privately indexable types based on where the aspects lay. > > OTOH, certain aspects such as (eg) Convention don't need to be public to alter the type in some manner. (Analogous to putting [eg] PRAGMA CONVENTION(FORTRAN, MATRIX) to force the Matrix to be represented in a Column-major manner within the private part.) > > I should write this up as an AI for the ARG, if for nothing else than clarification's sake. Thank you for bringing the issue to my attention. Thanks! One positive thing about it is that it does allow for safer indexing. Normally you have to expose a reference type with Implicit_Dereference, which exposes access types to your interface and also increases design complexity because you may have to figure out how to handle those reference types potentially outliving the container. Even though the issue I raised feels inconsistent, in some ways it might be safer than the standard way the containers handle indexing because the reference type is now private and a user cannot save it to a variable for later use.