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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c7ea1cb7a2beb2ee X-Google-Attributes: gid103376,public From: Charles Hixson Subject: Re: Disallowing Pre-Defined Operations Date: 2000/03/16 Message-ID: <38D15537.B06CA311@earthlink.net>#1/1 X-Deja-AN: 598470994 Content-Transfer-Encoding: 7bit References: <8a9eeg$qtv$1@newpoisson.nosc.mil> <8ababr$c3u$1@wanadoo.fr><8afhed$f9v$1@newpoisson.nosc.mil> <8aoifb$49f$1@newpoisson.nosc.mil> <38D001D7.4D6E4284@averstar.com> <38D013EF.1F431E34@cadence.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 953242951 198.94.156.19 (Thu, 16 Mar 2000 13:42:31 PST) Organization: EarthLink Inc. -- http://www.EarthLink.net MIME-Version: 1.0 NNTP-Posting-Date: Thu, 16 Mar 2000 13:42:31 PST Newsgroups: comp.lang.ada Date: 2000-03-16T00:00:00+00:00 List-Id: Re: Units: mks? cgs? or English System? (And is a gallon an Imperial Gallon or a US gallon?) Are angles measures in degrees, radians, or mils? (etc.) This feels like a very important issue to me, but if there is a generally applicable solution, I still don't know it. The closest I've come it to defining, say, Meters to be a particular data type descended from (Numeric... choose the appropriate flavor) that implements a toString feature. Of course then one doesn't have the operators defined until one does something like function "/"(x : Meters; y : Numeric) return Meters; et-multitudinous-cetera. Paul Graham wrote: > Tucker Taft wrote: > > > > "Charles H. Sampson" wrote: > > > ... > > > >You'll have to post the exact code if we're to understand what's going > > > >on there (all of the ops declared, and the supposedly ambiguous > > > >statement). And the error message. > > > > > > O. K., here's an example. It's not meant to meaningful, just to > > > show the problem, although I hope that the name for the integer variable > > > suggests how it could be used meaningfully. This example has been > > The techniques using discriminants are unsatisfactory in my view, > > and too "heavy." VHDL has the notion of "units" built into the language, > > and its approach should probably be evaluated. > > In VHDL units are mainly used for type TIME. Things get complicated > when you > try to map the physical world onto unit data types. For instance: > > type time is ... > type distance is ... > type velocity is ... > type acceleration is ... > type mass is ... > > function "/"(x : distance; y : time) return velocity; > function "/"(x : velocity; y : time) return acceleration; > function "*"(x : mass; y : acceleration) return force; > function "*"(x : force; y : distance) return work; > ... > > Anyway, you can see that the set of units and possible operations > between units > grows very quickly. I wonder how big a complete physical types package > would > be (complete enough to represent all the equations in a physics or > electonics > textbook for instance)? > > Paul