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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Some kind of repeating in Static_Predicate Date: Mon, 4 Jun 2018 16:33:46 -0500 Organization: JSA Research & Innovation Message-ID: References: <4ece357c-025c-45ff-9f5d-89c89d47e6c0@googlegroups.com> <87efhnoymp.fsf@jacob-sparre.dk> <503aed95-bd48-4eeb-a2a2-0f7bcc8de307@googlegroups.com> Injection-Date: Mon, 4 Jun 2018 21:33:47 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="3858"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:52933 Date: 2018-06-04T16:33:46-05:00 List-Id: "ytomino" wrote in message news:503aed95-bd48-4eeb-a2a2-0f7bcc8de307@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.