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.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,791ecb084fdaba75 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-10-04 04:04:53 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!sol.ctr.columbia.edu!usenet.ucs.indiana.edu!indyvax.iupui.edu!lmiller From: lmiller@indyvax.iupui.edu Newsgroups: comp.lang.ada Subject: Re: Types with physical dimension Message-ID: <1994Oct3.210603.8801@ivax> Date: 3 Oct 94 21:06:03 -0500 References: Date: 1994-10-03T21:06:03-05:00 List-Id: 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.