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 10.176.83.133 with SMTP id k5mr11158587uaa.23.1480451578465; Tue, 29 Nov 2016 12:32:58 -0800 (PST) X-Received: by 10.157.17.167 with SMTP id v36mr1359446otf.12.1480451578388; Tue, 29 Nov 2016 12:32:58 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!n6no3097237qtd.0!news-out.google.com!m27ni4805qtf.1!nntp.google.com!p16no3096018qta.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 29 Nov 2016 12:32:58 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=174.28.218.229; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 174.28.218.229 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <92ed75e9-baae-455c-9e34-53348dc6eaef@googlegroups.com> Subject: Re: Ada 2012 Constraints (WRT an Ada IR) From: Shark8 Injection-Date: Tue, 29 Nov 2016 20:32:58 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:32515 Date: 2016-11-29T12:32:58-08:00 List-Id: On Tuesday, November 29, 2016 at 1:17:38 AM UTC-7, G.B. wrote: > On 29.11.16 00:49, Shark8 wrote: > > it certainly would be convenient if they were as then we could have an = IR wherein the general form of a type-constraint is uniformly handled. >=20 > The notes section of LRM 3.2.4 may be of interest here. >=20 > Also, by way of extending the range of perspectives, maybe the > added flexibility of predicates entails not only overlap but also > separate handling. For example, being a positive (counting) > number means being an integer greater than 0. So, conceptually, > there is just one condition, not two as in a subtype constraint. >=20 >=20 > generic > type I is range <>; > package G is >=20 > subtype P is I with > Static_Predicate =3D> P > 0; >=20 > end G; >=20 >=20 > --=20 > "HOTDOGS ARE NOT BOOKMARKS" > Springfield Elementary teaching staff Perhaps, but thinking about an IR, it seems like it would be nice to use Ad= a's already implicit usage of sets more explicitly -- by which I mean thing= s like CASE requiring every value in its type (i.e. the set of values in it= s range) -- things like the "A predicate specification does not cause a sub= type to be considered constrained." has no impact on delineating the set of= acceptable values. Example: Type Serial_Number is new String with Dynamic_Predicate =3D> (for all Ch of Serial_Number =3D> Ch in '0'..= '9'; The above has a constraint -- that of only holding digits -- but still is u= nconstrained. If we were doing a formal CS class we'd say something like "T= he type Serial_Number contains all strings that have only the decimal digit= s therein." (Or somesuch, I'm borrowing from my memories of the class on DF= As, NFAs, etc.)