[ratio] Mini-review of the proposed ratio library

The review of Vicente Botet' Ratio library starts October 2nd and lasts until October 11th, 2010, unless an extension occurs.
What is it? ======== Portable implementation of the C++0x Standard Library's compile-time rational arithmetic working on C++03 and C++0x compilers. See the current C++0x working draft at http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3126.pdf - What is your evaluation of the design?
The question is essentially moot since Vicente followed the C++0x standard library design. The real question is "Does Boost need a library that every standard library vendor will be supplying anyhow?" For me, the answer is, yes, at least provisionally. The provisional part is because the library I'd really like to see in Boost in chrono. But we can't have <boost/chrono.hpp> without <boost/ratio.hpp>, so I'm in favor of ratio. The reason I'd like a Boost version is that I don't want to have to wait years and years to be able to use <boost/chrono.hpp> and <boost/ratio.hpp> in Boost libraries. I want to be able to use them with the compilers and standard libraries people are using today, not years from now.
- What is your evaluation of the implementation?
I am familiar with the original source code, and worked on boostifying it. Vicente has done a lot of work to make the code more robust in the Boost environment.
- What is your evaluation of the documentation?
I skimmed through it, and checked the header against the C++ standard. My impression is favorable.
- What is your evaluation of the potential usefulness of the library?
Chrono needs it:-)
- Did you try to use the library? With what compiler? Did you have any problems?
No.
- How much effort did you put into your evaluation? A glance? A quick - reading? In-depth study?
A quick skim through the docs.
- Are you knowledgeable about the problem domain?
Some knowledge, but far from an expert.
And finally, every review should answer this question:
- Do you think the library should be accepted as a Boost library?
Yes. I'm hoping others will post more in depth reviews. My review is really just a mini-review, but maybe will help to keep the ball rolling. --Beman

Hi, ----- Original Message ----- From: "Beman Dawes" <bdawes@acm.org> To: "Boost Developers List" <boost@lists.boost.org> Sent: Friday, October 01, 2010 3:03 AM Subject: [boost] [ratio] Mini-review of the proposed ratio library
The review of Vicente Botet' Ratio library starts October 2nd and lasts until October 11th, 2010, unless an extension occurs. - What is your evaluation of the design?
The question is essentially moot since Vicente followed the C++0x standard library design. The real question is "Does Boost need a library that every standard library vendor will be supplying anyhow?"
For me, the answer is, yes, at least provisionally. The provisional part is because the library I'd really like to see in Boost in chrono.
But we can't have <boost/chrono.hpp> without <boost/ratio.hpp>, so I'm in favor of ratio.
The reason I'd like a Boost version is that I don't want to have to wait years and years to be able to use <boost/chrono.hpp> and <boost/ratio.hpp> in Boost libraries. I want to be able to use them with the compilers and standard libraries people are using today, not years from now.
Yes, this is the main goal: To provide a "portable" version for C++03 and C++0x compilers so we can add on top of these standard libraries more on Boost.
- What is your evaluation of the implementation?
I am familiar with the original source code, and worked on boostifying it. Vicente has done a lot of work to make the code more robust in the Boost environment.
:)
- What is your evaluation of the potential usefulness of the library?
Chrono needs it:-)
I will add that Boost.Units could be refactored to use boost::ratio.
And finally, every review should answer this question:
- Do you think the library should be accepted as a Boost library?
Yes.
I'm hoping others will post more in depth reviews. My review is really just a mini-review, but maybe will help to keep the ball rolling.
Thanks for your possitive mini-review, Vicente

On Sep 30, 2010, at 9:03 PM, Beman Dawes wrote:
The review of Vicente Botet' Ratio library starts October 2nd and lasts until October 11th, 2010, unless an extension occurs.
What is it? ======== Portable implementation of the C++0x Standard Library's compile-time rational arithmetic working on C++03 and C++0x compilers. See the current C++0x working draft at http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3126.pdf - What is your evaluation of the design?
The question is essentially moot since Vicente followed the C++0x standard library design. The real question is "Does Boost need a library that every standard library vendor will be supplying anyhow?"
For me, the answer is, yes, at least provisionally. The provisional part is because the library I'd really like to see in Boost in chrono. But we can't have <boost/chrono.hpp> without <boost/ratio.hpp>, so I'm in favor of ratio.
The reason I'd like a Boost version is that I don't want to have to wait years and years to be able to use <boost/chrono.hpp> and <boost/ratio.hpp> in Boost libraries. I want to be able to use them with the compilers and standard libraries people are using today, not years from now.
There is one wrinkle. I've been experimenting with duration I/O, and Vicente has graciously picked that up. This is not in the C++0X working draft, nor will it be proposed for C++0X ... maybe TR2. Here is my experiment: http://home.roadrunner.com/~hinnant/duration_io/chrono_io.html In a nutshell, this addition is so that you can say: cout << ms; instead of: cout << ms.count() << " milliseconds"; to get: 13 milliseconds Stream input is also supported. This is a more interesting problem as it entails converting run time units (those units found in the stream at run time) into compile time units (the units associated with the duration being streamed into). For example you can stream istringstream("13 milliseconds") into a std::microseconds to get 13000 microseconds. There is an experimental <ratio_io> component, separate from <ratio>, to support the experimental <chrono_io>. http://home.roadrunner.com/~hinnant/duration_io/ratio_io.html -Howard

----- Original Message ----- From: "Howard Hinnant" <howard.hinnant@gmail.com> To: <boost@lists.boost.org> Sent: Friday, October 01, 2010 6:33 PM Subject: Re: [boost] [ratio] Mini-review of the proposed ratio library
On Sep 30, 2010, at 9:03 PM, Beman Dawes wrote:
The reason I'd like a Boost version is that I don't want to have to wait years and years to be able to use <boost/chrono.hpp> and <boost/ratio.hpp> in Boost libraries. I want to be able to use them with the compilers and standard libraries people are using today, not years from now.
There is one wrinkle. I've been experimenting with duration I/O, and Vicente has graciously picked that up. This is not in the C++0X working draft, nor will it be proposed for C++0X ... maybe TR2. Here is my experiment:
http://home.roadrunner.com/~hinnant/duration_io/chrono_io.html
Thanks Howard for providing these interesting additions with the BSL and accepting that I adapt them to Boost. Best, Vicente

On Fri, Oct 1, 2010 at 12:33 PM, Howard Hinnant <howard.hinnant@gmail.com> wrote:
There is one wrinkle. I've been experimenting with duration I/O, and Vicente has graciously picked that up. This is not in the C++0X working draft, nor will it be proposed for C++0X ... maybe TR2. Here is my experiment:
http://home.roadrunner.com/~hinnant/duration_io/chrono_io.html
In a nutshell, this addition is so that you can say:
cout << ms;
instead of:
cout << ms.count() << " milliseconds";
to get:
13 milliseconds
Stream input is also supported. This is a more interesting problem as it entails converting run time units (those units found in the stream at run time) into compile time units (the units associated with the duration being streamed into). For example you can stream istringstream("13 milliseconds") into a std::microseconds to get 13000 microseconds.
There is an experimental <ratio_io> component, separate from <ratio>, to support the experimental <chrono_io>.
http://home.roadrunner.com/~hinnant/duration_io/ratio_io.html
One of the advantages of Boost is that we can add extensions and get user experience before something gets standardized. That's very helpful to the C++ committee. --Beman
participants (3)
-
Beman Dawes
-
Howard Hinnant
-
vicente.botet