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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,802ee425bbc3eba3 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.223.40 with SMTP id qr8mr7192601pbc.0.1335878696906; Tue, 01 May 2012 06:24:56 -0700 (PDT) Path: r9ni119746pbh.0!nntp.google.com!news1.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: phil.clayton@lineone.net Newsgroups: comp.lang.ada Subject: Re: Quantified expressions: no support for restriction predicates Date: Tue, 1 May 2012 04:35:23 -0700 (PDT) Organization: http://groups.google.com Message-ID: <11223559.107.1335872123955.JavaMail.geo-discussion-forums@vbxz8> References: <22242340.4097.1335486547825.JavaMail.geo-discussion-forums@vbki8> <796413.773.1335612600942.JavaMail.geo-discussion-forums@vbai3> <9912125.1780.1335724639338.JavaMail.geo-discussion-forums@ynee1> NNTP-Posting-Host: 2.27.135.7 Mime-Version: 1.0 X-Trace: posting.google.com 1335878696 11209 127.0.0.1 (1 May 2012 13:24:56 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 1 May 2012 13:24:56 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2.27.135.7; posting-account=v7gx3AoAAABfjb9m5b7l_Lt2KVEgQBIe User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-05-01T04:35:23-07:00 List-Id: On Sunday, April 29, 2012 8:35:18 PM UTC+1, Robert A Duff wrote: > phil.c...@lineone.net writes: >=20 > > Is that actually possible for a Dynamic_Predicate? Section 3.2.4 Subty= pe Predicates, para 27/3 says: > > > > The discrete_subtype_definition of a loop_parameter_specification > > shall not denote ... or any subtype to which Dynamic_Predicate > > specifications apply. >=20 > Yeah, I think you're right. The idea is that we didn't want hidden > inefficiencies. >=20 > type T is new Integer with > Dynamic_Predicate =3D> T mod 10_000 =3D 0; > for X in T loop -- Illegal! >=20 > If that were legal, it would probably be grossly inefficient. Right, this is the key point. Writing pre- and postconditions where many e= lements are quantified over but immediately ignored due to a 'restriction p= redicate' is not good style, given these conditions are to be evaluated. I= t would be preferable to quantify over just the elements that satisfy the r= estriction predicate in the first place. For a subtype with a static predicate, presumably there is no efficiency is= sue because the restrictions placed on a static predicate enable the compil= er to generate code that skips the elements not satisfying the predicate. For static analysis, one would not worry about efficiency of evaluation and= restriction predicates are common-place. =20 Phil