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.66.17.234 with SMTP id r10mr4120550pad.40.1382426068437; Tue, 22 Oct 2013 00:14:28 -0700 (PDT) X-Received: by 10.182.28.129 with SMTP id b1mr3460obh.37.1382426068206; Tue, 22 Oct 2013 00:14:28 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!z6no56870301pbz.1!news-out.google.com!z6ni86181pbu.0!nntp.google.com!i2no26483927qav.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 22 Oct 2013 00:14:27 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=97.123.228.141; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 97.123.228.141 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <1830ad81-00dc-4639-922a-771a01cd06ec@googlegroups.com> Subject: Re: Making sense of predicates From: Shark8 Injection-Date: Tue, 22 Oct 2013 07:14:28 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:17493 Date: 2013-10-22T00:14:27-07:00 List-Id: On Monday, October 21, 2013 1:51:58 PM UTC-6, Dmitry A. Kazakov wrote: > Considering this: > type T is tagged null record; > procedure P (X : T); >=20 > type S is new T with null record; > procedure Q (X : T); >=20 > subtype Subclass is T'Class with > Dynamic_Predicate =3D> Subclass in S'Class; >=20 > -- Should have been Static_Predicate, but illegal Er, why not have: Function Is_S( Input : in T'class ) return boolean is ( Input in S'Class ); or just use S'class variables? >=20 > Well, predicates were not supposed to work in an intelligent way, so why > not to add a kind that will? I think they are supposed to work in an intelligent way, though perhaps the= y're not as nice as compile-time/static checks. > There are number of cases where this would be very useful. Agreed; I was disappointed the following doesn't work: Subtype Digit_Character is Character range '0'..'9'; Subtype Part_Number is String with Static_Predicate =3D> (for all C in Part_Number =3D> C in Digit_Cha= racter); As it would be nice to basically subtype out [further-constrain] the elemen= t-type just as we can do to the index (e.g. "Subtype Phone_Digits is String= (1..7);", which is equivalent to "subtype phone_range is Positive range 1..= 7; Subtype Phone_Digits is String(Phone_Range);", where 'phone_range' is an= anonymous subtype.)