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:fa18:: with SMTP id p24-v6mr9917647ioh.105.1528096530914; Mon, 04 Jun 2018 00:15:30 -0700 (PDT) X-Received: by 2002:a9d:5543:: with SMTP id h3-v6mr523874oti.13.1528096530816; Mon, 04 Jun 2018 00:15:30 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!feeder4.usenet.farm!feed.usenet.farm!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!u74-v6no4885385itb.0!news-out.google.com!z3-v6ni333iti.0!nntp.google.com!v8-v6no4881030itc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 4 Jun 2018 00:15:30 -0700 (PDT) In-Reply-To: <87efhnoymp.fsf@jacob-sparre.dk> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2400:416e:1ba5:1200:91e3:9198:6925:ea8c; posting-account=Mi71UQoAAACnFhXo1NVxPlurinchtkIj NNTP-Posting-Host: 2400:416e:1ba5:1200:91e3:9198:6925:ea8c References: <4ece357c-025c-45ff-9f5d-89c89d47e6c0@googlegroups.com> <87efhnoymp.fsf@jacob-sparre.dk> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <503aed95-bd48-4eeb-a2a2-0f7bcc8de307@googlegroups.com> Subject: Re: Some kind of repeating in Static_Predicate From: ytomino Injection-Date: Mon, 04 Jun 2018 07:15:30 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:52913 Date: 2018-06-04T00:15:30-07:00 List-Id: On Monday, June 4, 2018 at 3:26:56 PM UTC+9, Jacob Sparre Andersen wrote: > ytomino writes: > > > I'm trying to use a constant table (but that is unstable and may be > > changed in compile-time) in Static_Predicate. > > > > Set : constant String := ('T', 'a', 'b', 'l', 'e'); > > > > subtype T is Character > > with Static_predicate => (for some I of Set => X = I); > > Why not admit that it is a Dynamic_Predicate? > > Alternatively: > > type T is ('T', 'a', 'b', 'l', 'e'); > > Or: > > subtype T is Character > with Static_Predicate => (T in 'T' | 'a' | 'b' | 'l' | 'e'); > > Greetings, > > Jacob > -- > "people who live in glass houses shouldn't be throwing rocks > -- especially at those who don't live in glass houses" Thanks. But I want to separate the table and the subtype... As an example: (A): a platform-depended private package private package Mylib.Platform_Depended is -- for POSIX Separators : constant String := ('/', '\'); end; Or: private package Mylib.Platform_Depended is -- for Windows Separators : constant String := ('/', '\'); end; (B): using (A) private with Mylib.Platform_Depended; package Mylib.Path_Manipulators is Separators : constant String; subtype Directory_Separator is Character with Static_Predicate => (for I of Separators => Directory_Separator = I); -- **error** function Compose ( Path : String; Separator : Directory_Separator; Name : String) return String; ... private Separators : constant String := Platform_Depended.Separators; end; The reason of it's not Dynamic_Predicate is, I wish compile-time warning if possible.