On Thu, 2016-07-07 at 21:25 +0200, Phillip Helbig wrote:
> > We lost a $300 million project (Mars Climate Orbiter) because of a
> > mistake involving units, that would have been caught and automatically
> > corrected if the facilities I propose had been available and used.
>
> If all the programming was in Fortran. Was it?
The program that read Lockheed's small-force model file was all in
Fortran.
>
> > I don't think I'm alone. Does anybody else have this problem? Does
> > anybody else care about software reliability? Would anybody else like
> > to have assistance from the programming language? Maybe if you spoke
> > up, the "nobody asked us for it" excuse wouldn't carry much weight.
>
> Why not TYPEs like kilograms, meters, seconds, or, if you wish, BTUs,
> furlongs, microfortnights?
Using types, you need to write functions for assignment, and all the
arithmetic operations and intrinsic functions. This is expensive in
both labor and cycles. If you want to be able, for example, to
construct force from mass, length, and time, you get a combinatorial
explosion of functions.
Grant Petty has a package that encodes exponents for up to eight
fundamental units of your choice using components. Addition and
subtraction functions check consistency of exponents. Multiplication
and division add the exponents. It's expensive at runtime. It uses
eight times as much memory. It's not checked at compile time....
|