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:1742:: with SMTP id 63-v6mr49617iox.120.1528165805061; Mon, 04 Jun 2018 19:30:05 -0700 (PDT) X-Received: by 2002:a9d:296a:: with SMTP id d97-v6mr704684otb.1.1528165804824; Mon, 04 Jun 2018 19:30:04 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.166.215.MISMATCH!u74-v6no451538itb.0!news-out.google.com!f20-v6ni504itd.0!nntp.google.com!u74-v6no451535itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 4 Jun 2018 19:30:04 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2400:416e:1ba5:1200:a15d:2031:da2f:4757; posting-account=Mi71UQoAAACnFhXo1NVxPlurinchtkIj NNTP-Posting-Host: 2400:416e:1ba5:1200:a15d:2031:da2f:4757 References: <4ece357c-025c-45ff-9f5d-89c89d47e6c0@googlegroups.com> <87efhnoymp.fsf@jacob-sparre.dk> <503aed95-bd48-4eeb-a2a2-0f7bcc8de307@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <675621d4-7f23-48bd-a7e0-4105b21ddfd7@googlegroups.com> Subject: Re: Some kind of repeating in Static_Predicate From: ytomino Injection-Date: Tue, 05 Jun 2018 02:30:05 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:52938 Date: 2018-06-04T19:30:04-07:00 List-Id: On Tuesday, June 5, 2018 at 6:33:48 AM UTC+9, Randy Brukardt wrote: > "ytomino" wrote in message > news:503...@googlegroups.com... > > 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... > > That seems backwards to me. You are wanting to declare a set subtype, and > Ada uses the silly static predicate for doing so rather than having a proper > set constraint. Either way, that's a subtype declaration. > > So the operative thing here is the subtype. There's no "table" in a set > description. If you need to check membership in the set, you just do that > with "in". > > Thus: > > subtype T is Character > with Static_Predicate => (T in 'T' | 'a' | 'b' | 'l' | 'e'); > > if Param in T then ... > > If you really needed a table, I'd construct that from the set. (But I can't > imagine what the use would be, certainly in cases like the "separators" > definition you showed in another mail.) > > Randy. Thanks. I understood it's backwards. Yes, the table is needless in run-time. I want only compile-time checking by Static_Predicate in this case. Also, types should be more primary than constants basically. However, a subtype declaration can't be separated to another package... The table may be configured before compiling, like the example of directory separators.