comp.lang.ada
 help / color / mirror / Atom feed
From: Quentin Ochem <qochem@gmail.com>
Subject: Re: Anouncement: OpenGL Binding w/ Ada-2012.
Date: Wed, 24 Oct 2012 09:32:20 -0700 (PDT)
Date: 2012-10-24T09:32:20-07:00	[thread overview]
Message-ID: <1dd4109c-1190-4d51-ae57-d171a4d50f41@googlegroups.com> (raw)
In-Reply-To: <277d0e8f-6b00-44e9-8d1f-1d25007fcc72@googlegroups.com>


> 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;

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.

Just my 2 cents...



  parent reply	other threads:[~2012-10-24 16:32 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 [this message]
2012-10-24 20:40   ` Shark8
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