Code Generation:
The library is code-generated and is bounded by hard limits in every base dimension. This means that only arithmetic operations that result in types which exist in the library are possible. This is due to the fact that neither C# nor Java support numeric generic parameters. To see how C++ can implement the same ideas more elegantly, visit the appropriate section.

You can rebuild the library in order to select different bounds. The library is generated using Python scripts included in the distribution. I have used IronPython, but CPython or Jython will probably do. The actual code generation is done by script "". Scripts "" and "" define appropriate text templates for classes, the dimension boundaries, the unit separator (I have used '·') and a callback function to implement the different behavior regarding placement of the code in C# and Java (C# code resides in one file, while Java code resides in files per class). Please note that "" does not create package directories "org/dimenso". You must move the generated classfiles there yourself.

The code for interface "DimensionedValue" is not generated by the Python scripts. You must get it from the original distribution.
You might also wish to explore a different venue: adding "business" dimensions to the mix, like number of employees, number of shuttles, kilograms of gazoline. This would add the same level of safety to calculations that involve other kinds of entities. Any calculation that would reference units of any type, when described in prose, can benefit from checking the units involved.
You can download IronPython from Codeplex.
© 2007 Dimitrios Souflis (dsouflis at acm dot org) - Original template by Salis @