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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,886c71cc8d798d67 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.83.35 with SMTP id n3mr5160831pay.23.1351111252794; Wed, 24 Oct 2012 13:40:52 -0700 (PDT) Received: by 10.68.190.35 with SMTP id gn3mr5342500pbc.13.1351111252779; Wed, 24 Oct 2012 13:40:52 -0700 (PDT) Path: s9ni23372pbb.0!nntp.google.com!kr7no9734670pbb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 24 Oct 2012 13:40:52 -0700 (PDT) In-Reply-To: <1dd4109c-1190-4d51-ae57-d171a4d50f41@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.20.190.126; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 69.20.190.126 References: <277d0e8f-6b00-44e9-8d1f-1d25007fcc72@googlegroups.com> <1dd4109c-1190-4d51-ae57-d171a4d50f41@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Anouncement: OpenGL Binding w/ Ada-2012. From: Shark8 Injection-Date: Wed, 24 Oct 2012 20:40:52 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-10-24T13:40:52-07:00 List-Id: On Wednesday, October 24, 2012 10:32:20 AM UTC-6, Quentin Ochem wrote: > > If you do give it a try, feel free to post impressions, ideas, suggestions. > > One suggestion: there's a number of cases where pre conditions can be replaced by proper subtyping, e.g.: > > procedure PointSize (size : float) > with pre => not Executing AND size > 0.0; > > > Can be replaced by: > subtype Positive_Float is Float range 0.0 .. Float'Last; > procedure PointSize (size : Positive_Float) > with pre => not Executing; Can it? I'd have to take a look at the way Ada's ranges for floats work again to tell. IIRC it's [Min_val..Max_Val), if that is the case there is one important value which is not precluded from the parameter of the new specification: 0.0. > > It seems good practice to use subtyping whenever possible, in particular if it's a property of a parameter, and let Pre condition for more complex properties related to the subprogram as a whole. Agreed. Very much agreed. > > Just my 2 cents... Thank you much.