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:a37:68a:: with SMTP id 132mr2414337qkg.359.1572966644470; Tue, 05 Nov 2019 07:10:44 -0800 (PST) X-Received: by 2002:a9d:4042:: with SMTP id o2mr5099624oti.22.1572966644164; Tue, 05 Nov 2019 07:10:44 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!j16no2532285qtl.0!news-out.google.com!g53ni765qtg.0!nntp.google.com!j16no2532277qtl.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 5 Nov 2019 07:10:43 -0800 (PST) In-Reply-To: <530a0f85-158a-4c42-b826-04ae4bd46451@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=146.5.2.231; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 146.5.2.231 References: <21fa6db8-4b86-459f-bc5a-70993f92c28a@googlegroups.com> <27cb5366-4b3d-4f33-b8ec-2bc71c70780c@googlegroups.com> <530a0f85-158a-4c42-b826-04ae4bd46451@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: How to best make a custom range? From: Shark8 Injection-Date: Tue, 05 Nov 2019 15:10:44 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:57485 Date: 2019-11-05T07:10:43-08:00 List-Id: On Tuesday, November 5, 2019 at 7:02:37 AM UTC-7, Andrew Shvets wrote: > This is what I have now. >=20 > subtype DNA_Chars is Character range =E2=80=98A=E2=80=99 .. =E2=80=98Z=E2= =80=99; > subtype DNA_Symbols is Character with Static_Predicate =3D> DNA_Symbols i= n =E2=80=98 =E2=80=98; > subtype DNA_Char is Character with Static_Predicate =3D> DNA_Char in DNA_= Chars | DNA_Symbols; >=20 > And this is the warning that I get (one of many, but I can=E2=80=99t copy= and paste): >=20 > warning: in instantiation at a-nudira.adb:54 > type =E2=80=9CResult_Subtype=E2=80=9D has predicates, attribute =E2=80=9C= First=E2=80=9D not allowed OK, the problem here is that the Ada language *does* discriminate between s= ubtypes with predicates and those without -- mostly because there are argum= ents about how such attributes should behave. Things like if we have: TYPE Digits is range 0..9; SUBTYPE Odds is Digits with Static_Predicate =3D> Odds in 1|3|5|7|9; what should Odds'Pred(1) be? 0? Constraint_Error? what about Odds'Pos(1) should it be 0, the first item of the subtype? Or 1,= the position in the parent-type?