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:bb42:: with SMTP id l63-v6mr4593862iof.101.1531587888473; Sat, 14 Jul 2018 10:04:48 -0700 (PDT) X-Received: by 2002:aca:f495:: with SMTP id s143-v6mr2117140oih.7.1531587888301; Sat, 14 Jul 2018 10:04:48 -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!border2.nntp.dca1.giganews.com!nntp.giganews.com!d7-v6no3630448itj.0!news-out.google.com!l67-v6ni3972itl.0!nntp.google.com!d7-v6no3630443itj.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 14 Jul 2018 10:04:48 -0700 (PDT) In-Reply-To: <40d568da-4715-42de-8e28-98da39a5c974@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=76.113.16.86; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 76.113.16.86 References: <40d568da-4715-42de-8e28-98da39a5c974@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Visibility of Indexing aspects From: Shark8 Injection-Date: Sat, 14 Jul 2018 17:04:48 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:53816 Date: 2018-07-14T10:04:48-07:00 List-Id: 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: Package Tmp_2 is Type K(<>) is private; Private Function Valid( Input : String ) Return Boolean; Type K is new String with Dynamic_Predicate => Valid( String(K) ); Function Valid( Input : String ) Return Boolean is (for all CH of Input => CH /= ' '); End Tmp_2; In fact, the subprograms refereed to in the predicate don't need to be visible at the point of declaration: Package Tmp is Type K(<>) is private with Dynamic_Predicate => Valid( String(K) ); Private Function Valid( Input : String ) Return Boolean; Type K is new String; Function Valid( Input : String ) Return Boolean is (for all CH of Input => CH /= ' '); End Tmp;