* Re: Reuseable Scientific Types Package
[not found] ` <396A373A.1B80329F@lmco.com>
@ 2000-07-12 0:00 ` David Kristola
2000-07-12 0:00 ` Brian Rogoff
0 siblings, 1 reply; 3+ messages in thread
From: David Kristola @ 2000-07-12 0:00 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 3+ messages in thread