From: none <""knoppix\"@(none)">
Subject: Re: WG: SI Units - has Ada missed the boat?
Date: Wed, 11 Jul 2007 21:27:30 -0400
Date: 2007-07-11T21:27:30-04:00 [thread overview]
Message-ID: <46958287$0$8946$4c368faf@roadrunner.com> (raw)
In-Reply-To: <mailman.1.1183971374.3834.comp.lang.ada@ada-france.org>
Grein, Christoph (Fa. ESG) wrote:
>>One of my pet hopes for Ada2005 was that it would include some method
>>of automatically checking systems of units at compilation time or with
>>minimal run-time checking. Alas it was voted down due to time
>
>
> I have to admit that I was the main perpetrator who killed that
> proposal.
>
>
>>Is anyone still working on an Ada solution to this?
>
>
> I don't think so, if you mean a method to include in the Ada standard.
>
Back in the 80's I was working on a simulator, where we the software
people wrote the infrastucture and the various subject area specialists
wrote the code for the things they wanted to simulate.
We (software weenies) created a package (wish I could remember the name
of it) that provided basic types LENGTH_UNITS, TIME_UNITS, SPEED_UNITS,
DISTANCE_UNITS, TEMPERATURE_UNITS, ANGLE_UNTIS, etc. and then defined
all of the overloaded operators to convert between those.
The upshot of this was the convers stuff got so large and complec that
we wrote a program that would read a text file that would define the
conversions i.e. LENGTH_UNITS = SPEED_UNITS * TIME_UNITS... etc, the
program then was able to define the base conversion and the related
conversions ( SPEED_UNITS = LENGTH_UNITS / TIME_UNITS ), etc.
I don't remember the details but there was also a way to define the
conversion from various units into the generic _UNITS. For instance for
LENGTH_UNITS, METERS would = 1, feet would be whatever the conversion
from feet to meters is, furlongs would be defined similarly.
This program would then write the ADA specs and bodies for the conversion.
Down side :
This was in 1986ish. The "UNITS" package took about 4 hours to compile
(on a VAX using VAX ADA) and every component took a long time to compile
because every expression had to be compared to the myriad of overloads
to determine if the expression was valid.
If a conversion didn't exist, you added the appropriate info to the
conversion file (and hope you did it right), checked it back into CM,
and the build ran overnight. The next morning you could compile your
expression.
Up side :
We NEVER had unit conversion issues, as the unit analysis was done by
the compiler.
This enabled the subject matter experts to write code that
defined a value of type say mytime : TIME_UNITS, and myspeed :
SPEED_UNITS, mydistance : LENGTH_UNITS (sorry rusty ADA syntax) and then
mytime := FROM_FOTNIGHTS ( 10.0 ) ;
myspeed := FROM_METERS_PER_SECOND ( 100.0 ) ;
mydistance = myspeed * mytime ;
PRINTLN ( TO_FURLONGS ( mydistance ) ) ;
and
myint : INTEGER ;
myint = 10 ;
mydistance = myspeed * myint ; would not compile.
You can see why the conversion package got so big... it had to defein
ALL valid conversions.
Sorry this was so long. Wish I could remember more of the details
It was one of the most fun ADA jobs I worked on.
Joe Simon
WB2JQT
next prev parent reply other threads:[~2007-07-12 1:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-09 8:55 WG: SI Units - has Ada missed the boat? Grein, Christoph (Fa. ESG)
2007-07-09 9:49 ` Dmitry A. Kazakov
2007-07-10 1:26 ` Hyman Rosen
2007-07-10 9:14 ` Martin
2007-07-10 9:22 ` Martin
2007-07-12 1:27 ` none [this message]
2007-07-12 10:39 ` Colin Paul Gloster
2007-07-13 22:20 ` Dr. Adrian Wrigley
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox