comp.lang.ada
 help / color / mirror / Atom feed
From: lmiller@indyvax.iupui.edu
Subject: Re: Types with physical dimension
Date: 3 Oct 94 21:06:03 -0500
Date: 1994-10-03T21:06:03-05:00	[thread overview]
Message-ID: <1994Oct3.210603.8801@ivax> (raw)
In-Reply-To: INFO-ADA%94092805521945@VM1.NODAK.EDU

Stephe Leake at NASA GSFC (NBSSAL@stdvax.gsfc.nasa.gov) worked on something
like this some years ago.  I never worked with the packages produced but was
told by Stephe that the huge number of types generated made for long compile
times on good compilers and vast ugly deaths on poor ones.  His final analysis: 
neat, but not quite worth the effort.  For cartesian and other multi
dimensional stuff I found creating types which reflected reality quite useful
in pointing out errors at compile time.  Overloading the operators then made
for very readable expressions in code.  

type CART_AXES is (X, Y, Z);
type POLAR_AXES is (Lat, Long, Radius);
-- continue for all helpful coordinate systems...

type CART_VECTORS is array (CART_AXES) of Float;
type POLAR_VECTORS is array (POLAR_AXES) of Float;


Then the compiler will always kick you in the shin if you try to add
cart_vectors and Polar_Vectors without defining the proper operators.  One can
just imagine all of the opportunities C provides to make multitudes of mistakes
related to this situation.  





  parent reply	other threads:[~1994-10-04  2:06 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-09-28 10:55 Types with physical dimension Simtel20 Transfer
1994-09-28 18:56 ` Mark A Biggar
1994-10-04  2:06 ` lmiller [this message]
     [not found] <GRAHAM.94Sep27181841@canopus.clsi.com>
1994-09-28 17:36 ` William Brennan
1994-09-28 21:41 ` Tucker Taft
1994-09-29  4:11   ` Robert Dewar
1994-09-29 11:19     ` Peter Hermann
1994-09-30 10:17       ` Dr John Stockton
1994-10-03  4:37       ` Robert Dewar
1994-09-29 13:37     ` Tucker Taft
1994-10-03  4:40       ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1994-09-28 19:28 Paul Pukite
1994-09-27 22:18 Paul Graham
1994-09-28 13:59 ` Robert Dewar
1994-09-30  2:06   ` R_Tim_Coslet
1994-10-03 17:31 ` Stephen A. Leake
1994-10-04 11:51   ` Robert I. Eachus
1994-10-04 19:45     ` Mark A Biggar
     [not found]       ` <CxBBx8.7L@irvine.com>
1994-10-13 22:15         ` gamache
1994-10-12  3:43     ` Matt Kennel
1994-10-04 14:56   ` Robert Dewar
1994-10-05 14:53     ` Bob Gilbert
1994-10-05  8:38   ` Jean-Pierre Rosen
1994-10-05 10:35     ` Stephen J Bevan
1994-10-05 13:17       ` Jean-Pierre Rosen
1994-10-05 15:48     ` Norman H. Cohen
replies disabled

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