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,b7057cb195a2dcbd X-Google-Attributes: gid103376,public From: David Kristola Subject: Re: Reuseable Scientific Types Package Date: 2000/07/12 Message-ID: <01HW.B5917CD403727A5405DE478C@news.pacbell.net>#1/1 X-Deja-AN: 645389610 Content-Transfer-Encoding: 7bit References: <3963A48E.6A2AF132@gbr.msd.ray.com> <39646F40.A8277C4E@linuxchip.demon.co.uk> <01HW.B58C5C88023DF64C05DE478C@news.pacbell.net> <396A373A.1B80329F@lmco.com> Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@pacbell.net X-Trace: news.pacbell.net 963391165 63.194.212.92 (Wed, 12 Jul 2000 01:39:25 PDT) Organization: heaps of stacks User-Agent: Hogwasher 2.0 (Macintosh) MIME-Version: 1.0 NNTP-Posting-Date: Wed, 12 Jul 2000 01:39:25 PDT Newsgroups: comp.lang.ada Date: 2000-07-12T00:00:00+00:00 List-Id: On Mon, 10 Jul 2000 13:51:06 -0700, Howard W. LUDWIG wrote (in message <396A373A.1B80329F@lmco.com>): > David Kristola wrote: >> A third option... >> >> I too needed types with units. With a little bit of work, i created a >> program to auto-generate a types package with appropriate operators for >> all of the types needed (an extensive list, which caused the number of >> operators to explode). {snip} > Bill Whitaker certainly realized this when he participated > in revising IEEE-Std. 1226, a project that became known as > P1446. His work on the original 1226 used the Kristola > approach, which he regarded as manageable at the time. > By the time P1446 rolled around, it became clear to Bill > that one could never set up enough types and operators, > so he switched over to something closer to the Pat Rogers > approach. (Ref. the index page > http://users.erols.com/whitaker/ > and see metric.sty that led to IEEE-Std.1226; as well as > iss_418.htm and si_cmts.txt that describe the adjusted > approach used in the update P1446, which never made it > past the draft stage.) I will take a look at the document, thanks! I was not looking to make reusable software when i cam up with the idea. Reuse is not within our scope. Our schedule is very tight, and we are not being paid to produce a reusable product. I think the idea of having a code generator might be reusable. A user could enter in the set of types she is interested in and produce a types package with just those types. Any individual project is likely to be limited in the units that are important. {Snip} >> type Unitless_Type is new Interfaces.IEEE_Float_32; >> subtype Radians_Type is Unitless_Type; >> --... >> type Per_Seconds_Type is new Unitless_Type; >> subtype Radians_Per_Seconds_Type is Per_Seconds_Type; > > It is true that the radian is a dimensionless unit (meaning > it has dimensions of 1, sometimes expressed in the non-reduced > form m/m, based on its definition), but "per second" is > certainly not "unitless", nor is "radians per second". > Is the information given above simply incomplete and you > are deriving all (including Meters_Type, etc.) of your unit > types from "Unitless_Type", or am I missing something else? I think you are missing something. Per_Seconds_Type is a *new* type based on Unitless_Type. Any good compiler will optimize away any machine code for a type convert from one to the other, but you can't add them together without a type convert. {Snip} >> I am also playing with some ideas for a possible language extension. >> This is one area where more power could be added to the language. Much >> of the unit checking can be done at compile time. How bad does something >> like this look? >> >> type Unitless_Type is digits 6 with (Meters, Kilograms, Seconds); > > Don't forget the other 4 base units in SI (ampere, kelvin, > mole, candela). Also, there are people who, in spite of all > the good reasons to use [only] SI, still use such abominations > as feet and pounds; most throw in at least the multiples and > submltiples of SI units such as kilometer and gram. The best > mechanism will allow for those as well. I was just giving an example. I would have used Klingon units if i knew what they were. The idea is to have a user defined list of units that accompany the type. I have not spent as much time thinking about the idea as i would like. It needs some more thought before i write up a description. For instance, before this thread, i had not considered fractional powers. -- --djk, keeper of arcane lore & trivial fluff Home: David95036 plus 1 at america on-line Spam: goto.hades@welovespam.com