comp.lang.ada
 help / color / mirror / Atom feed
* Re: Another Idea for Ada 20XX
@ 2001-12-02 19:51 Gautier Write-only-address
  2001-12-02 22:36 ` James Rogers
  2001-12-03 14:56 ` Another Idea for Ada 20XX Mark Lundquist
  0 siblings, 2 replies; 53+ messages in thread
From: Gautier Write-only-address @ 2001-12-02 19:51 UTC (permalink / raw)
  To: comp.lang.ada

>From: James Rogers

>In scientific terms a measurement is done in terms of some unit.
>For instance, distance is in meters, microns, feet or furlongs.
...
>calculations. Because of the added computational overhead, there must
>be a way to choose or reject unit analysis for defined types.

The overhead is not only computational, I fear: if programmers
are forced to specify the unit of each of their variables
with a possible physical meaning, they just won't program in
Ada...

Where is the problem, indeed ? Mixing feets and meters in a
program ? This is more a political or cultural problem, I
wouldn't wish to complicate Ada with it...

____________________________________________________________
Gautier  --  http://www.mysunrise.ch/users/gdm/index.htm#Ada

NB: Do not answer to sender address, visit the Web site!


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp




^ permalink raw reply	[flat|nested] 53+ messages in thread
* Re: Another Idea for Ada 20XX
@ 2001-12-02 21:24 Gautier Write-only-address
  2001-12-03 14:56 ` Mark Lundquist
  0 siblings, 1 reply; 53+ messages in thread
From: Gautier Write-only-address @ 2001-12-02 21:24 UTC (permalink / raw)
  To: comp.lang.ada

>Especially for Space programs between US and Europe this would
>be a *huge* benefit.
>Just declare :
>
>type Inchs is Distance unit x Meters;
>
>and the compiler will do all unit conversions for you.
>
>And of course :
>type Temperature is basic concept with basic unit Kelvin;
>type Celsius is Temperature unit 1 Kelvin + 273.15;

Why not - but the more subtle you design the unit management,
the more subtle the mistakes will be...
The choice of *one* unit system should be made *before* any
programming, otherwise you don't get out of problems.
And in some applications (scientific programming) you can forget
these amusements about units, there are just too many variables.
____________________________________________________________
Gautier  --  http://www.mysunrise.ch/users/gdm/index.htm#Ada

NB: Do not answer to sender address, visit the Web site!

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp




^ permalink raw reply	[flat|nested] 53+ messages in thread
* Another Idea for Ada 20XX
@ 2001-12-02 16:01 James Rogers
  2001-12-02 16:38 ` Preben Randhol
                   ` (5 more replies)
  0 siblings, 6 replies; 53+ messages in thread
From: James Rogers @ 2001-12-02 16:01 UTC (permalink / raw)


In scientific terms a measurement is done in terms of some unit.
For instance, distance is in meters, microns, feet or furlongs.
Speed is then calculated as a distance per unit time. Acceleration
is the second derivative of speed.

I would like to have this notion of measurement units and their
relationships supported in a language. This would require the language
to perform unit analysis while performing static or run-time 
calculations. Because of the added computational overhead, there must
be a way to choose or reject unit analysis for defined types.

Perhaps a new keyword for unit-analyzed types could be introduced,
along the lines of the keyword "tagged" added to Ada 95. A unit-
analyzed type would carry its own unit description tag to 
facilitate unit analysis. Any numeric type without such a tag
would not be subject to unit analysis.

Possible declarative syntax might be:

type Meters is unit range (0.0..1.0E380);
type Hours is unit range (0.0..9.99E30);
type Speed is unit(Meters / Hours);

The advantage for the software developer is in the usage:

Vehicle_Speed : Speed;
Track_Distance : Meters;
Lap_Time : Hours;

Speed := Track_Distance / Lap_Time;

This approach would allow the appropriate mixing of data types, which
is currently forbidden by Ada, in a meaningful and correct manner.

I know this proposal places a heavy burden upon compiler writers.
I also suspect it would be very useful for ensuring the correctness
of programs, particularly in embedded systems. 

Note that a lot of the unit analysis could be performed statically.
This would allow minimal performance penalty at run time.

Jim Rogers
Colorado Springs, Colorado USA



^ permalink raw reply	[flat|nested] 53+ messages in thread

end of thread, other threads:[~2001-12-10 20:59 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-02 19:51 Another Idea for Ada 20XX Gautier Write-only-address
2001-12-02 22:36 ` James Rogers
2001-12-03 12:44   ` Marc A. Criley
2001-12-03 14:29     ` Larry Kilgallen
2001-12-04  0:25       ` Marc A. Criley
2001-12-04  1:40   ` Adrian Hoe
2001-12-04  1:56     ` Larry Kilgallen
2001-12-04 16:08       ` Wes Groleau
2001-12-04 17:48         ` Larry Kilgallen
2001-12-09 23:02           ` Nick Roberts
2001-12-10 16:22             ` Stephen Leake
2001-12-10 17:11               ` Wes Groleau
2001-12-10 20:30               ` Robert C. Leif, Ph.D.
2001-12-10 20:59                 ` Wes Groleau
2001-12-10 17:09             ` Wes Groleau
2001-12-10 17:32               ` Larry Kilgallen
2001-12-04 19:59         ` Vincent Marciante
2001-12-04 20:20           ` Wes Groleau
2001-12-04 22:18         ` Matthew Heaney
2001-12-06  4:14         ` Richard Riehle
2001-12-06 17:39           ` Wes Groleau
2001-12-07  0:55             ` Adrian Hoe
2001-12-07  9:01               ` Dmitry A. Kazakov
2001-12-07 11:49           ` Tarjei T. Jensen
2001-12-07 22:51           ` Dimensions (was Re: Another Idea for Ada 20XX) Mark Lundquist
2001-12-08  3:52             ` Richard Riehle
2001-12-08  5:28               ` Mark Lundquist
2001-12-08 18:59                 ` Matthew Heaney
2001-12-08 21:23               ` Wes Groleau
2001-12-09 22:15               ` Robert C. Leif, Ph.D.
2001-12-10 14:09             ` Ian
2001-12-03 14:56 ` Another Idea for Ada 20XX Mark Lundquist
2001-12-06 15:27   ` Philip Anderson
2001-12-07 22:51     ` Mark Lundquist
2001-12-10  9:01       ` Dmitry A. Kazakov
  -- strict thread matches above, loose matches on Subject: below --
2001-12-02 21:24 Gautier Write-only-address
2001-12-03 14:56 ` Mark Lundquist
2001-12-02 16:01 James Rogers
2001-12-02 16:38 ` Preben Randhol
2001-12-02 22:26   ` James Rogers
2001-12-02 21:19 ` Patrick Hohmeyer
2001-12-02 21:26 ` Lutz Donnerhacke
2001-12-02 23:49   ` Patrick Hohmeyer
2001-12-03  6:06     ` Wilhelm Spickermann
2001-12-03  8:58     ` Lutz Donnerhacke
2001-12-03 13:40     ` Thomas Koenig
2001-12-03  0:21 ` Robert C. Leif, Ph.D.
2001-12-03  0:35 ` Robert Dewar
2001-12-03  1:33   ` James Rogers
2001-12-03 12:34     ` Dirk Dickmanns
2001-12-03 14:56 ` Mark Lundquist
2001-12-03 15:12   ` Lutz Donnerhacke
2001-12-03 17:00   ` chris.danx

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox