Re: [boost] [Review] Quantitative Units library review begins today, March 26

What is your evaluation of the design? My biggest design concerns at the moment: 1. The scope of the library must neccessarily be limited. It should contain the dimensional analysis framework, all predefined base and derived physical dimensions, dimensionless constants, metric prefix wrappers, possibly the SI units of measurement, and that's about it. All other dimensions, units, and systems of measurement should be treated as "localized" extensions that are built on top of this library. 2. Exponents should be tightly coupled to their respective dimension or unit. Specifying them implicitly in a list as a pair is not tightly coupled. unit< meter, 1, gram, 2, second, -1 > Make the exponent a template parameter of the dimension or unit. This syntax is more natural and more intuitive. unit< meter<1>, gram<2>, second<-1> > 3. Generally speaking, the vast majority of units are converted to one another by simply multiplying the quanity by a factor. The current proposal potentially requires a separate template specicialization for each of these conversions. This type of conversion should be generalized, if at all possible, into a single generic operation. What is your evaluation of the implementation? My biggest concerns about the implementation: 4. Many Boost libraries follow the "fine-grained" header policy (e.g. MPL) while also providing convenience headers that include entire components or the entire library with a single include directive. Looking at the proposed library, I would like to see at least one convenience header file that includes the "core" library. Also a few of the headers are rather large and should be broken into smaller headers. 5. Don't see the need for ordinal class template. How is it different from the MPL integer constant wrappers? There are also other such questionable symbols (e.g. the whole operators.hpp header, make_dimension_list). 6. Code that should ideally be included as part of other Boost libraries (e.g. static_rational as part of Boost Math) should be defined within the ideal namespace to indicate the intended namespace partitioning even if the header currently resides in the proposed library. 7. The code sometimes confuses dimensions and units. Example: boost/units/systems/si/length.hpp:22:typedef unit<length_type,SI::system> length; Length is a dimension, not a unit. The type name 'length_type' however does have a sensible definition: ./boost/units/systems/physical_units.hpp:typedef fundamental_dimension<length_tag>::type length_type; Meter however is a unit and its dimension is length but to define 'meter' as a constant, even a constant whose type is 'length', looks really suspect of a design tradeoff: ./boost/units/systems/si/length.hpp:BOOST_UNITS_STATIC_CONSTANT(meter,le ngth); Not sure about the benifits and drawbacks of such a design. What is your evaluation of the documentation? Adequate for purposes of the proposal. It would need quite a bit more work to bring it up to the level of other Boost libraries. Compared to design and implementation of such a library, this is a relatively small issue. What is your evaluation of the potential usefulness of the library? Apart from some usage issues and prototypical implementation, it's headed in the right direction. Some scientists and engineers will certainly find it useful as is but many programmers will have issues with its current form I believe. Did you try to use the library? With what compiler? Did you have any problems? I tried to build the examples on MSVC 8.0 and Mac OS X but couldn't because there is only a BoostBuild v2 Jamfile and v2 is troublesome to say the least. A v1 Jamfile would have been extremely helpful. How much effort did you put into your evaluation? Few days of code and documentation review with light experimentation and testing of the examples. Are you knowledgeable about the problem domain? Enough to design and write a similar library and thus be aware of all the issues involved with such development. Do you think the library should be accepted as a Boost library? Not in its current form. While it does demonstrate the potential for becoming a Boost library, it needs more work. Symptomatically, the authors have stated that the library is still in development and I am hesitant to formally accept any library that is still in development. I would politely recommend that the authors gather, analyze, and integrate all review commments so far. I would also encourage rigorous testing by a larger, more objective audience. Eric.

There are varying opinions on this point. We are attempting to provide a complete implementation of the SI standard unit system along with a "reasonable" subset of other commonly used units or SI conversion factors for them. Perhaps you're right - all non-SI units should be moved provisionally to the examples until enough users have put the library though the wringer and have given input on other units/systems that ought to be incorporated in the core library.
They are - the dimension_list that encodes dimension itself is a list of fundamental dimension tag/static_rational value pairs.
Sure - any suggestions on naming the all inclusive header?
the headers are rather large and should be broken into smaller headers.
Which ones, in particular?
Ordinal could be replaced with mpl::int_; I'll look at it. We've already stated that we'll look at replacing static_* with the corresponding MPL classes.
I have no problem with doing this.
This definition is in the SI namespace, so, while length is a dimension, SI::length is a unit (aka meter).
Not sure about the benifits and drawbacks of such a design.
Benefits have been discussed in various emails during the review. Mainly, it enables a syntax that is succinct, clear, and unambiguous.
I've done all development on Mac OSX without problems either using v2 or XCode without bjam at all. Steven and a number of others have had similar success on a number of other compilers including MSVC 7.1/8.0. Thanks for your comments. Matthias

...
The problem is that everyone will have a different opinion on what is "reasonable". And as we have seen also, even the SI units are subject to local conventions which is why I said "possibly the SI units of measurement". Many countries use the "metre" spelling and many others use "meter" and one of these names would be an important symbol in a units library. And if this is supposed to be internationally standardized unit, other units and systems will be even more problematic. Conclusion: Don't even worry about incorporating them into the "core" library. Leave them as extensions -- supplements if you will -- and you can even distribute them along with the core library if like. The important thing is the core library will be much more stable and can be maintained independently.
Usually the names of such convenience headers reflect the directories of header files that they include. The <boost/type_traits.hpp> header is a good example and <boost/units.hpp> would be a nice addition. Once you break down headers into smaller files (next paragraph), identifying other such headers is trivial.
Any header file that contains more than one public symbol. That's the general rule for the "fine-grained" inclusion policy. Sounds like a lot of work I know but there are good reasons for doing so especially in an MPL-based library where optimized preprocessing is paramount. Eric.

AMDG Eric Lemings <lemings <at> roguewave.com> writes:
All other dimensions, units, and systems of measurement should be treated as "localized" extensions that are built on top of this library.
The core library in boost/units/ doesn't know or care about anything in boost/units/systems/.
You only have to specify the conversion for the base units. Thus to convert m^2 -> ft^2 you only need to define the conversion from meters to feet. In Christ, Steven Watanabe
participants (3)
-
Eric Lemings
-
Matthias Schabel
-
Steven Watanabe