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.99.66.199 with SMTP id p190mr11092864pga.20.1480376977180; Mon, 28 Nov 2016 15:49:37 -0800 (PST) X-Received: by 10.157.8.134 with SMTP id 6mr762466otf.17.1480376977115; Mon, 28 Nov 2016 15:49:37 -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!1.eu.feeder.erje.net!feeder.erje.net!2.us.feeder.erje.net!newspeer1.nac.net!border2.nntp.dca1.giganews.com!nntp.giganews.com!n6no2599540qtd.0!news-out.google.com!j8ni10868qtc.0!nntp.google.com!p16no2598448qta.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 28 Nov 2016 15:49:36 -0800 (PST) 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 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Ada 2012 Constraints (WRT an Ada IR) From: Shark8 Injection-Date: Mon, 28 Nov 2016 23:49:37 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:32501 Date: 2016-11-28T15:49:36-08:00 List-Id: So, with Ada 2012 we gained some really nice possibilities with the way to = express constraints, the downside is that there's now a fairly wide range o= f ways to express constraints on types. Obviously these differences must be= accounted for, but the are functionally equivalent, for example: Subtype P0 is Natural range Natural'Succ(Natural'First)..Natural'Last; Subtype P1 is Integer range 1..Integer'Last; Subtype P2 is Integer with Static_Predicate =3D> P2 in 1..Integer'Last or e= lse raise Constraint_Error; Subtype P3 is Integer with Static_Predicate =3D> P3 in 1..Integer'Last, Predicate_Failure =3D> raise Constraint_Error; Now, these should be generally the same way of writing the same thing (ie "= Positive") -- though I'm not completely certain that this is the case in te= rms of subtle semantics (am I missing something?) -- it certainly would be = convenient if they were as then we could have an IR wherein the general for= m of a type-constraint is uniformly handled. Comments? Insights?