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.146.84 with SMTP id s20mr28642241pgn.82.1480963377351; Mon, 05 Dec 2016 10:42:57 -0800 (PST) X-Received: by 10.157.17.167 with SMTP id v36mr3744368otf.12.1480963377284; Mon, 05 Dec 2016 10:42:57 -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!p16no2932686qta.1!news-out.google.com!m27ni1820qtf.1!nntp.google.com!n6no2933658qtd.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 5 Dec 2016 10:42:56 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=67.0.242.189; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 67.0.242.189 References: <92ed75e9-baae-455c-9e34-53348dc6eaef@googlegroups.com> <03847fd7-5699-48de-bb3c-ef5512398f26@googlegroups.com> <3ef819e8-55f7-4ef7-9f37-77e6abc33f98@googlegroups.com> <47366b42-c0a3-41bf-a44a-5241c109d60f@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <58f477d2-8b01-4001-bad8-47ea73424f4c@googlegroups.com> Subject: Re: Ada 2012 Constraints (WRT an Ada IR) From: Shark8 Injection-Date: Mon, 05 Dec 2016 18:42:57 +0000 Content-Type: text/plain; charset=UTF-8 Xref: news.eternal-september.org comp.lang.ada:32617 Date: 2016-12-05T10:42:56-08:00 List-Id: On Monday, December 5, 2016 at 4:09:42 AM UTC-7, Simon Wright wrote: > > [...] > > Things called in Ada pre- and post-conditions if evaluated during > > run-time are merely subprogram bodies booby-trapped with unanticipated > > exceptions. Bad thing. > > Just as bad a thing as Constraint_Error. > > To me, there's no practical difference, at any rate from a black box > point of view, between a language-defined exception and an assertion (or > condifion) failure; just a matter of who defines what is out of the > envelope for the program. And now we come back full-circle to the topic of the thread: Subtype P0 is Integer range 1..Integer'Last; Subtype P3 is Integer with Static_Predicate => P3 in 1..Integer'Last, Predicate_Failure => raise Constraint_Error; are conceptually the same thing (although in Ada they are implemented differently such that turning off assertions makes P3 not raise Constraint_Error). Since these are conceptually the same, they should have similar representations in an IR, preferably the same representation with a flag/discriminant on the constraint indicating whether or not turning assertions off impacts the condition-check.