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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1dd28d5040ded1f8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-14 09:59:51 PST From: "Martin Dowie" Newsgroups: comp.lang.ada References: <3CD88FBD.4070706@telepath.com> <3CD91E31.1060004@telepath.com> <3CDBD673.FF452A3D@otelco.net> <4519e058.0205140718.3ddb1b2a@posting.google.com> Subject: Re: Announce: Grace project site operational Date: Tue, 14 May 2002 18:02:11 +0100 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 NNTP-Posting-Host: sg2c11210.sd.edinbr.gmav.gecm.com Message-ID: <3ce1424a$1@pull.gecm.com> X-Trace: pull.gecm.com 1021395530 sg2c11210.sd.edinbr.gmav.gecm.com (14 May 2002 17:58:50 +0100) Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!213.56.195.71!fr.usenet-edu.net!usenet-edu.net!freenix!fr.clara.net!heighliner.fr.clara.net!isdnet!btnet-peer1!btnet-feed5!btnet!newreader.ukcore.bt.net!pull.gecm.com!not-for-mail Xref: archiver1.google.com comp.lang.ada:24037 Date: 2002-05-14T18:02:11+01:00 List-Id: "Ted Dennison" wrote in message news:4519e058.0205140718.3ddb1b2a@posting.google.com... > That's the biggie. If you try to make separate types for velocities > and accelerations, you will suddenly find that you also need separate > types for times and distances, and perhaps even Hz and mass and forces > and rotational orientations and velocitites and accelerations. Then > you'll find how annoying it is to have to do type conversions on every > factor in every formula. A more attractive option may be to write your > own math operators that return the correct type given their two input > types. But that causes an exponential growth in operators that you > have to create every time you add a new unit. > > To do this kind of thing *right*, you'd really need a language that > relies on structural equivalence for types, and automaticly generates > the proper new type given the operator and the types of its operands. > In Ada, you just can't do that. > > Generally, what I see Ada folk do is use *subtypes* for all this > stuff. That way ranges are checked, but formulas don't become a chore > (although you still have to be really careful with intermediate values > blowing out of subtype constraints). Can't say I've ever seen these as subtypes and I'm not sure I like the idea... The ability to not add volts and metres together is one of things I like about Ada! In the same vein as the standard Ada maths library doesn't try to cover _all_ possible maths packages, an 'elementary SI' package should be possible (I feel) to cover 99% of project needs (e.g. SI units and support for powers to the +/- 3 plus a base 'dimensionless' unit). I have no evidence to support this supposition other than my own experience that the above would cover every project I've ever work on (and that's including some heavy duty 3-d geometry type projects). It might be big, it might not be pretty, but once its there it's not exactly going to be changing! :-)