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.121.132 with SMTP id u126mr36673186pgc.1.1481150546218; Wed, 07 Dec 2016 14:42:26 -0800 (PST) X-Received: by 10.157.4.119 with SMTP id 110mr4805681otc.11.1481150546148; Wed, 07 Dec 2016 14:42:26 -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!n6no4054144qtd.0!news-out.google.com!j8ni11074qtc.0!nntp.google.com!p16no4052109qta.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 7 Dec 2016 14:42:25 -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: <03847fd7-5699-48de-bb3c-ef5512398f26@googlegroups.com> <3ef819e8-55f7-4ef7-9f37-77e6abc33f98@googlegroups.com> <47366b42-c0a3-41bf-a44a-5241c109d60f@googlegroups.com> <58f477d2-8b01-4001-bad8-47ea73424f4c@googlegroups.com> <6e206c3b-d4a8-44ab-9e0e-adb0924983ef@googlegroups.com> <10e8cb52-1cbd-40ed-ba11-f474c2263ced@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <8e3b18a7-1e64-40bb-8d99-66fdeba58ace@googlegroups.com> Subject: Re: Ada 2012 Constraints (WRT an Ada IR) From: Shark8 Injection-Date: Wed, 07 Dec 2016 22:42:26 +0000 Content-Type: text/plain; charset=UTF-8 Xref: news.eternal-september.org comp.lang.ada:32666 Date: 2016-12-07T14:42:25-08:00 List-Id: On Tuesday, December 6, 2016 at 4:23:55 PM UTC-7, Randy Brukardt wrote: > "Shark8" wrote in message > > > >But something did occur to me in the interim: > > > >One reason that an IR could be handy is as an execution model -- like how > >Intel's iAPX 432 was designed for Ada's feature-set -- having a generalized > >form for constraints/violations would mean that the the chip would only > >have > >to handle one kind of constraint-type instead of having to have specialized > >forms for P3 and P0. > > You seem to be assuming that it is practical to represent all kinds of > predicates as some sort of set. That's definitely not true; one of the major > reasons that you can't use divide or mod in a static predicate is the > difficulty of representing the set. For instance, consider: > > subtype Even is new Natural with Dynamic_Predicate => Even mod 2 = 0; > > If Natural is a 64 bit type, Even is a set of 2**63 items, no two are > contiguous. The representation of that is going to be a problem. One could > imagine some special case to deal with this particular case, but then there > are many other possible predicates with this property. Just because it's represented as a set doesn't mean that the set has to be represented as a bit-mask. (The obvious breaking example for that implementation here would be a string subtype constrained to contain only numeric characters.) Haskell, IIRC, has no problem dealing with infinite sequences. > Thus, your hypothetical IR would have to represent ranges as predicates, > rather than as some sort of set. But that would make it hard to do > operations on the IR (such as merging and check elimination). Would it though? Don't we have tools (and entire programming languages) built around predicate-logic?