Boost logo

Boost :

Subject: Re: [boost] [Review] Boost.Convert library, last day
From: Matthew Chambers (matt.chambers42_at_[hidden])
Date: 2011-05-03 18:26:19


On 5/3/2011 5:04 PM, Vladimir Batov wrote:
> As for your not-working example
>
>> f(boost::convert<std::string>::from(123));
>
> then 'yes' it does not work the way *you* intentionally deploy 'convert'. For it
> to work it needs to be
>
> f(boost::convert<std::string>::from(123).value());

This issue itself could decide the library's acceptance IMO. I.e. is it acceptable design that some
(possibly many) contexts will require the extra call to value? I personally don't like sometimes
requiring it and other times not. Especially when I suspect it will lead to plenty of confusing
template-heavy compile-time errors and in some cases possibly some very hard to pinpoint runtime
errors! These errors are especially significant IMO when the most common use of the library is for
seemingly simple conversions. I am beginning to realize the danger of implicit conversions
(something I hadn't thought much about before)...

It's not right to say "it does not work the way *you* intentionally deploy" because it's a perfectly
reasonable usage. At the very least you would need to warn about it in the documentation.

-Matt


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