From: Deane Yang (deane_yang_at_[hidden])
Date: 2007-02-16 21:51:35
Matthias Schabel wrote:
>> 1) I do not need a library that insists on defining some "system of
>> units" to which everything gets converted.
> A major design goal of mcs::units was to allow users to work in a system
> that matches their problem. These can be physical units, but can be
> anything else, also...
But I don't want the user of the library to have to define a "system" of
units just to use a function in the library. If there is, say, a
function that takes a distance, a mass, and a time and does computations
with them, the user should be able to feed into that function arbitrary
units for each of the three without having to use the dimensions library
to define a system first.
So the thing I didn't like in your version of my sample code is the need
for a template parameter called "System".
I think in another post you yourself indicate how these
defined-by-convention "systems" of units used by physicists cause some
awkwardness, because a system might not define the units for momentum to
be equal to the units of mass times the units of distance divided by the
units of time, creating the need for extra conversions.
I am pretty badly prejudiced as a mathematician. I think within a single
code module, one should forget these arbitrary man-made conventions and
code using mathematically consistent units (so the units for the product
of two dimensions are always the product of the the units of the two
dimensions, etc.). This yields in my opinion much cleaner mathematical
formulas with simpler constants and therefore cleaner code as well. My
view is that conventions like SI units should appear only in the
interface to the module, and the first thing that the module should do
on entry is to convert everything to a mathematically consistent set of
units, rather than a set conforming to a rather arbitrary convention.
(I'm sorry if I sound like a closed-minded cranky old mathematician, but
that's exactly what I am.)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk