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.6 required=5.0 tests=BAYES_00,TO_NO_BRKTS_FROM_MSSP autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,43bc631fb4a56c2a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-11 06:57:02 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!out.nntp.be!propagator-dallas!news-in-dallas.newsfeeds.com!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison References: <9fnbtt$ild$1@e3k.asi.ansaldo.it> <41F37C284A6DE8C0.8A6A99719FF11B52.8149DC60E20677C9@lp.airnews.net> Subject: Re: Unchecked_Conversion Message-ID: <164V6.3802$pb1.139228@www.newsranger.com> X-Abuse-Info: When contacting newsranger.com regarding abuse please X-Abuse-Info: forward the entire news article including headers or X-Abuse-Info: else we will not be able to process your request X-Complaints-To: abuse@newsranger.com NNTP-Posting-Date: Mon, 11 Jun 2001 09:56:13 EDT Organization: http://www.newsranger.com Date: Mon, 11 Jun 2001 13:56:13 GMT Xref: archiver1.google.com comp.lang.ada:8541 Date: 2001-06-11T13:56:13+00:00 List-Id: In article <41F37C284A6DE8C0.8A6A99719FF11B52.8149DC60E20677C9@lp.airnews.net>, Robert B. Love says... > >In Ted Dennison wrote: >> Just to back up Marc here, you should almost *never* have to convert >types. The >> only times I ever have to do it are when interfacing with external >routines that > >My experience runs counter to this. My employer has chosen to use >typing for every conceivable measurement. So we have type Meters, >Meters_Per_Second, Feet, Feet_Per_Second, Seconds, Watts, Volts, and so >on. >The list is endless. I'm sorry. There was an implied "with unchecked_conversion" in there. I often perform type conversions between numeric types or derived types. As for the particular (quite different) issue you are talking about: I've worked with various groups that had to deal with engineering units, and they all tend towards the same conclusion. You can either use "integer" and "float" for everything, or you can make a separate type for each and every unit and intermediate unit you will ever need, along with your own overloaded operators for every operation that you will ever perform on any combination of them. Any wishy-washyness in the middle just causes headaches of the kind you have described. As the "separate type for everything" route is almost always prohibitive, usually folks opt for the minimalist route. Of course it can still be a good idea to use constrained subtypes, esp. for routine interfaces. There can also be a case for making separate types in certain cases where you want something special done and don't mind rewriting all the operators to work with integer or float to achieve that goal (eg: a Degrees type that automaticly does a "mod 360" on any operator result). --- T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html home email - mailto:dennison@telepath.com