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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: Ada 2012 Constraints (WRT an Ada IR) Date: Thu, 22 Dec 2016 10:54:29 +0100 Organization: A noiseless patient Spider Message-ID: References: <1af458a8-cf5b-4dd7-824d-eed1ed5ffb21@googlegroups.com> Reply-To: nonlegitur@notmyhomepage.de Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 22 Dec 2016 09:53:03 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="4874372b9b6af048cb990afa545d9aab"; logging-data="3333"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Om+kUO50pzYRNPBRkATNAUwLHDnnoCtc=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 In-Reply-To: Cancel-Lock: sha1:jwgsvJ1HSQbuQbCtk7LeA6E3b5E= Xref: news.eternal-september.org comp.lang.ada:32942 Date: 2016-12-22T10:54:29+01:00 List-Id: On 21/12/2016 22:15, Dmitry A. Kazakov wrote: > There is a far better and safer model to produce user-defined subtypes that this mess. Can you, please, show one? >>> That would produce non-sets. >> >> At compile time? Otherwise, how can a specification of membership by >> any Boolean function "produce" anything but that decision, if it does >> compute a result? > > When predicate is not a complete function of the argument, e.g. > > P (x) = (Integer (Clock - Epoch) mod 2) = 1 Dynamic_Predicate => ... as you specified ... produces a set, however random; this is predictable. Just like before in older Ada, i.e., to the extent that the set of a range constraint on S is predictable in procedure ... (N : Integer) is subtype S is Natural range 2 .. N; Your Clock base membership stest will be more involved, whatever its purpose might be. It will compute a Boolean result, as long as the inputs allow. See below. > Engineers insisting that 2+2=5 or doing things because the spirit of Napoleon told them so are to be fired and probably sent to medical examination. Why does 2+2=5 apply when from a static predicate, but not when from an Ada expression in general?