comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <onewingedshark@gmail.com>
Subject: Re: Anouncement: OpenGL Binding w/ Ada-2012.
Date: Wed, 24 Oct 2012 13:40:52 -0700 (PDT)
Date: 2012-10-24T13:40:52-07:00	[thread overview]
Message-ID: <e3db30ee-b014-4215-b488-d5b37bb31001@googlegroups.com> (raw)
In-Reply-To: <1dd4109c-1190-4d51-ae57-d171a4d50f41@googlegroups.com>

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.



  reply	other threads:[~2012-10-24 20:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-18 17:16 Anouncement: OpenGL Binding w/ Ada-2012 Shark8
2012-10-24  3:38 ` joel.s.williamson
2012-10-24 20:33   ` Shark8
2012-10-24 16:32 ` Quentin Ochem
2012-10-24 20:40   ` Shark8 [this message]
2012-10-25 22:22     ` Quentin Ochem
2012-10-26  1:46       ` Shark8
2012-10-26 13:50 ` Yannick Duchêne (Hibou57)
2012-10-27  1:56   ` Shark8
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox