comp.lang.ada
 help / color / mirror / Atom feed
From: christoph.grein@eurocopter.com
To: comp.lang.ada@ada-france.org
Subject: Re: Macks - adding unit constants?
Date: Thu, 6 Nov 2003 10:58:35 +0100 (MET)
Date: 2003-11-06T10:58:35+01:00	[thread overview]
Message-ID: <mailman.291.1068113592.25614.comp.lang.ada@ada-france.org> (raw)

> >   Dist: constant SI := 0.000_86 * Meter;
> > or
> >   Dist: constant SI := 0.86 * Milli * Meter;
> 
> This is in some ways more to my taste.  Here there are no conversions of 
> dimensionless numbers to dimensioned numbers.  But I prefer the 
> compile-time checking I get with Macks to the run-time checking implied 
> in the above examples.

Compile time checking will only work for simple cases satisfactorily.

How are you going to handle fractional powers? (See my paper).
How power series?
Every now and then you will run into problems because a certain overloading of 
multiplication operators is not available and you have to reorder your 
expression in order to make it compile.
With Macks, you still have the wrong overloadings (e.g. T*T giving T for any 
type T) still present, albeit abstract, and those _can_ screw up overloading 
resolution under certain conditions.

ARG has abandoned a proposal for Ada05 that would have added unit checking at 
compile time because of the many problems that come with it. (One of the authors 
was Tucker Taft.)

If you really want dimension checking in full generality (my personal feeling 
is, it's not worth it, real software problems are buried somewhere else, see Ada 
Europe Conference 2003, Springer Verlag *), you need a run-time method where 
dimensions can easily be switched off when the code has been subject to 100% 
coverage unit testing (because then you have _proved_ that all equations are 
dimensionally correct).

(*) I can send you the PDF file if you're interested.

Christoph Grein



             reply	other threads:[~2003-11-06  9:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-06  9:58 christoph.grein [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-11-03 11:57 Macks - adding unit constants? christoph.grein
2003-11-05 23:38 ` Jacob Sparre Andersen
2003-10-20 11:08 christoph.grein
2003-10-09  7:57 Jacob Sparre Andersen
2003-10-14 16:01 ` Stephen Leake
2003-10-17 20:23   ` Jacob Sparre Andersen
2003-10-20 14:48     ` Preben Randhol
2003-11-03 11:45       ` Jacob Sparre Andersen
2003-11-03 14:24         ` Preben Randhol
2003-10-20 19:06     ` Stephen Leake
2003-11-03 11:45       ` Jacob Sparre Andersen
replies disabled

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