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 2002:a24:908:: with SMTP id 8-v6mr4662737itm.36.1531592983639; Sat, 14 Jul 2018 11:29:43 -0700 (PDT) X-Received: by 2002:aca:c744:: with SMTP id x65-v6mr2181281oif.2.1531592983410; Sat, 14 Jul 2018 11:29:43 -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!g2-v6no3680745itf.0!news-out.google.com!l67-v6ni3972itl.0!nntp.google.com!d7-v6no3687703itj.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 14 Jul 2018 11:29:43 -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> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <7742818a-8789-4a0d-b420-e170a89dcf5e@googlegroups.com> Subject: Re: Visibility of Indexing aspects From: Jere Injection-Date: Sat, 14 Jul 2018 18:29:43 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:53817 Date: 2018-07-14T11:29:43-07:00 List-Id: On Saturday, July 14, 2018 at 1:04:49 PM UTC-4, Shark8 wrote: > On Saturday, July 14, 2018 at 8:18:38 AM UTC-6, Jere wrote: > > I was going through an Ada library and noticed that they > > were able to add an indexing aspect to a type in the private > > section of a package but have the indexing work for types > > declared using the public view of the type. It's a neat feature, > > but I wasn't sure if this was intentional or a GNAT bug? > > I searched through sections 13.1 and 4.1.6 of the RM, but no > > mention that I could find of the private/public requirements > > for the Variable_Indexing and Constant_Indexing aspects. > > > > Is there something I missed in the RM, is this a GNAT bug, or > > something else? > > I'm not sure what your problem is; it's perfectly fine to attach the predicate in the Private section: I have no problem with it per say, but it runs contrary to how I have experienced Ada so far, so I wanted to make sure before I make use of it that it isn't a compiler bug. This marks the first time I have ever encountered a situation where the client of a package can leverage functions from the private part of a package. In my example, I expected that client had no access to any functionality of the Container type because the public specification for it was: package Containers is type Container is private; private 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.