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!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Ada 2012 Constraints (WRT an Ada IR) Date: Tue, 29 Nov 2016 18:03:06 -0600 Organization: JSA Research & Innovation Message-ID: References: NNTP-Posting-Host: rrsoftware.com X-Trace: franka.jacob-sparre.dk 1480464129 2945 24.196.82.226 (30 Nov 2016 00:02:09 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Wed, 30 Nov 2016 00:02:09 +0000 (UTC) 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.6157 Xref: news.eternal-september.org comp.lang.ada:32526 Date: 2016-11-29T18:03:06-06:00 List-Id: "Shark8" wrote in message news:f2c50fc6-18e1-48c7-8db7-aca274c74ac7@googlegroups.com... > On Tuesday, November 29, 2016 at 10:53:59 AM UTC-7, Niklas Holsti wrote: ... >> > Subtype P2 is Integer >> > with Static_Predicate => P2 in 1..Integer'Last >> > or else raise Constraint_Error; >> >> Perhaps it was obvious to you, but this differs from Positive in that >> you cannot write P2'First or similar (illegal by RM 3.2.4(26/3)), but >> you can write Positive'First. > > But insofar as a "type" (the collection of values and operations*) goes it > is the same: its > values have the same range, the operations* are the same, and it raises > the same error > when they are violated. > > * Assuming we're considering attributes as something different than an > 'operation' and excluding them. That's a pretty strange thing to do, IMHO. (And keep in mind the difference of operation for memberships that I noted previously -- do you want to exclude that, too??) >> > Subtype P3 is Integer with >> > Static_Predicate => P3 in 1..Integer'Last, >> > Predicate_Failure => raise Constraint_Error; >> >> Same difference as for P2, I think. >> > > So there *IS* something in common about all the above, that's what the > thrust of the topic (an Ada IR) is getting at. Perhaps we better start back that the beginning. What do you mean by "IR"? I had assumed that you wanted advice for chosing between these possibilities, but this message seems to be concentrating on implementing an Ada compiler. That seems irrelevant to virtually all Ada users (my advice, as always, when thinking about starting a new Ada implementation, is DON'T -- no one -- or even a small group -- has the 15 years of effort needed). I'd rather talk about things that are relevant. Randy.