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-03 11:05:56 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!swrinde!elroy.jpl.nasa.gov!ames!newsfeed.gsfc.nasa.gov!news!sal714 From: sal714@rs710.gsfc.nasa.gov (Stephen A. Leake) Newsgroups: comp.lang.ada Subject: Re: Types with physical dimension Date: 03 Oct 1994 17:31:09 GMT Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA Message-ID: References: NNTP-Posting-Host: rs710.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit In-reply-to: graham@clsi.COM's message of 27 Sep 1994 22:18:41 GMT Date: 1994-10-03T17:31:09+00:00 List-Id: In article graham@clsi.COM (Paul Graham) writes: ... One can model physical types in Ada by using private types, but this involves writing a lot of operators. What do Ada programmers do to guard against dimensional errors? I run robots with Ada, so I deal with real dimensions all the time. Very early on, I started to write a package that enforced dimensionality; I defined METERS, METERS_PER_SECOND, etc. I quickly discovered that even simple equations need up to cubic dimensions, in all combinations of length, mass and time. Defining all these types and the associated operators was far too time-consuming to be worth it. So now I rely on code reviews and careful testing. The moral; strong typing is nice, but is no substitute for careful design and thorough testing. -- Stephen Leake, NASA Goddard Space Flight Center email: Stephen.Leake@gsfc.nasa.gov