Boost logo

Boost :

From: Deane Yang (deane_yang_at_[hidden])
Date: 2004-01-03 10:53:08

Andy Little wrote:
solutions need to be found...
> However "arbitrary-physical-quantities-like-widgetty-things-that
> do-something-configurably" is much too loose a specification.
> I cant take any of this too seriously without a tighter definition of what
> you guys are actually talkng about.

I did provide in a much earlier posting a precise abstract mathematical
definition of what is needed, but I guess it was a little hard to
follow. (1-dimensional vector spaces, their duals and tensor products)

And I have yet to see anyone give a precise definition of what a
"physical dimension" is.

And people have already provided any number of specific examples. I've
done work in finance, where the following quantities are quite useful:
calendar time (dates, days, months, years)
periodic time (coupon periods)
derived units (per-year, per-period, years-squared, periods-squared,
                square-root-of-years, per-square-root-of-years)

Notice that conversions between the different units are not clear-cut
and need to be controllable by the user. In fact, what is more important
than the conversion between different fundamental units but the
automatic checking of arithmetic expressions involving derived units
(allow per-period * period but not per-period * years).

In fact, my vote is to have no automatic conversion of units at all.
I just want the compiler to throw up an error message every time
it finds an inconsistent use of units. I find that within any given
module, I always want to use a consistent set of units, even if in
theory I could use a units library to convert everything automatically
into a consistent set of units. The use of inconsistent units in
a single line of code for me is a signal that I have poorly organized
and error-prone code. Am I the only one that feels this way?

By the way, referring to an earlier message by Andy, what are the ground
rules for people being allowed to express opinions? Am I only allowed to
say something, if I am trying to build my own version of the library?
I sure wish I had the time to, but I simply don't.

I am, in fact, using a primitive version that I built myself and,
despite its many limitations, have found extremely helpful.
I would also say that on the basis of what I've read here, Matthias's
approach looks closest to what I'm looking for.

Boost list run by bdawes at, gregod at, cpdaniel at, john at