Boost logo

Boost :

Subject: Re: [boost] Conversion review
From: Ralph Tandetzky (ralph.tandetzky_at_[hidden])
Date: 2011-08-23 05:20:10


A note to an earlier message before I start my review:
>> - STL conversions
>>
>> I believe these functions are of little use as when I would have to
>> convert a list of integers to a list of doubles I'd simply write a
>> loop (possibly aided by BOOST_FOREACH) instead of looking up a library
>> (and reading the necessary documentation) to do it for me.
> I respect your approach, but I have see tones of code using these kind
> of loops that cluter the comprehension of the code. I prefer to use a
> function. Nothing forces you to use this function.
>> With the offered customization points the cure seems to be worse than
>> the disease, if I had to convert a std::pair<int, int> to a
>> std::pair<double, double> I'd write a quick function to do so.
There's nothing easier than converting a list of integers to a vector of
doubles:
     std::list<int> li;
     // fill list with something ...
     std::vector<double> vd( li.begin(), li.end() );
Concerning std::pair<int,int> to std::pair<double,double> conversion:
There's already a template constructor in the std::pair class which does
that.

My review:
* What is your evaluation of the design?
Looks like good design.

* What is your evaluation of the implementation?
I didn't look into it.

* What is your evaluation of the documentation?
Looks quite accurate. For my taste the documentation is a litte to
verbose. For example the bullet points in "How to Use This
Documentation" can be left out in my opinion. There were a few typos:
"Unfortunately this doesn't work<s> as overload resolution doesn't take
care of template type parameters that can not be deduced from the
function arguments. *Boost.Conversion* provides a customization
<customization> point that takes in account the |Source| and the
|Target| types (see below). "

* What is your evaluation of the potential usefulness of the library?
I don't like implicit conversions in the first place. This hasn't
anything to do with the library itself. But providing implicit
conversions can create temporary objects or make a program behave weird
in the strangest places. Sometimes versions of overloaded functions are
called, you wouldn't expect. Some stuff compiles, where you would rather
have a compile time error than a runtime crash. I try to avoid implicit
conversions and prefer handwritten conversion where neccessary. This way
you will always know what's happening in your code. Therefore the
library would not be of great use for me. I'm not against implicit
conversions per se, but from my experience they should be used with
great care. Using this library might suggest the opposite to the
unexperienced user.

* Did you try to use the library? With what compiler? Did you have any
problems?
No I didn't try the library.

* How much effort did you put into your evaluation? A glance? A quick
reading? In-depth study?
I read the overview and had a glance at the tutorial.

* Are you knowledgeable about the problem domain?
It's a rather basic domain. As any professional C++ programmer would be.

* Do you think the library should be accepted as a Boost library? Be
sure to say this explicitly so that your other comments don't obscure
your overall opinion.
NO. Explicit conversions might be fine, but implicit conversions should
be used with great care and should mostly be avoided. I mentioned
reasons for that in the answer about usefullness. Explicit conversion
can be done by handwritten functions without studying another library.

Best regards,
Ralph.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk