I have been making extensive use of some C++ classes I wrote to do compile time unit analysis in IMP. I find them very useful and wouldn t want to have to write code without them and as a result thought I would ask if others are interested. They enable things like - automatically converting between different length measures (say angstroms and nanometers) so you don't have to worry which number is which - check that unit types match, so can can't assign an energy value to a force or daltons to kilograms - convert between SI units and the energy units used in IMP etc. You use them by writing things like Nanometer side(10); CubicAngstrom volume= side*side*side; Nanosecond time_step(10); simulation_parameters.set_maximum_time_step(time_step); // it otherwise would want femtoseconds
As a said, I quite like using them and would like to make them generally available. There are a couple of holdups: - since it is a compile time library, it doesn't really translate to python, so we would need to continue to provide separate units and unit free interfaces for things (for example SimulationParameters has set_maximum_time_step and set_maximum_time_step_in_femtosecond, the latter just takes a double - Boost, has added its own units library (as of 1.36). It is based on the same principles as mine (they both grew out of a Boost.MPL example) but there are various differences so converting to the boost one would take a bit of work and we would need to provide some of our own code on top of the boost library.
My thought had been to wait until IMP required a new enough boost and switch to that, but it is taking a while. Are people interested? The code is pretty stable, but could use a bit of documentation and cleanup if others are to use it.