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.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 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 07:46:06 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!isdnet!psinet-france!psiuk-f4!psiuk-p4!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: Unchecked_Conversion Date: Mon, 11 Jun 2001 10:21:30 -0400 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: <9g2k5c$nt6$1@nh.pace.co.uk> References: <9fnbtt$ild$1@e3k.asi.ansaldo.it> <41F37C284A6DE8C0.8A6A99719FF11B52.8149DC60E20677C9@lp.airnews.net> NNTP-Posting-Host: 136.170.200.133 X-Trace: nh.pace.co.uk 992269292 24486 136.170.200.133 (11 Jun 2001 14:21:32 GMT) X-Complaints-To: newsmaster@pace.co.uk NNTP-Posting-Date: 11 Jun 2001 14:21:32 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:8545 Date: 2001-06-11T14:21:32+00:00 List-Id: This sounds like someone got sent to an Ada class that talked about the goodness of data types and then they got all excited and started making *everything* a type - only to discover that you *can* have too much of a good thing. Types can be good for constraint validation and avoiding the mixing of things that shouldn't be mixed. However, if every data item you have is a distinct type, that is rather implying that you never mix them - and this starts making life miserable. Meters and Seconds are often combined to produce Meters/Second. Are you gaining some benefit by forcing each to a different type? (maybe. maybe not.) (BTW: It would be a mistake to think that Ada *forces* this on you. Just like in C or other languages, you could do everything as type Integer or Float. Whether or not you should, is an open question & dependent on your application.) IMHO, there isn't anything inherently wrong within an application with saying "Meters and Seconds will never exceed the type Float_64, so they will both be stored as such" (or possibly as subtypes of Float_64.) This may be because in your app, you are frequently measuring both and mixing them mathematically. Where I think strong types make a lot more sense is when you have to control representation or enforce constraints or you are creating operations specific to some class of objects. ("Seconds" would want to be a separate type if I had various time-related functions taking seconds as parameters & I never wanted those subprograms to accept Meters.) Just because I'm reading in two values that represent measurements in two different units does not in and of itself, in my mind, justify creation of two different types. There is a bit of "Art" in the construction of good quality code, so you can't write absolute rules such as "Everything must have its own type!" and expect goodness to flow out of it. Perhaps there are some books or research papers that might lead to some Programming Proverbs in this area? MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/ "Robert B. Love " wrote in message news:41F37C284A6DE8C0.8A6A99719FF11B52.8149DC60E20677C9@lp.airnews.net... > 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. > > To avoid conversions I would have to have hundreds of overloaded > operators. > And to make matters worse, we have generic vectors that can be > instantiated > for the basic types above. I would have to have overloaded operators for > all the vector combinations. > > No, using Ada in my problem domain, you are constantly converting types. > And it can be a pain. >