Boost logo

Boost :

Subject: Re: [boost] [review] Convert library
From: Roland Bock (rbock_at_[hidden])
Date: 2014-05-26 08:20:08


On 2014-05-26 12:34, Vladimir Batov wrote:
> Roland Bock-2 wrote
>> On 2014-05-26 10:45, Vladimir Batov wrote:
>>> ..
>>> So, I had to be mindful of that.
>> Sorry, if I annoyed you. Documenting is horribly hard since you know
>> your motivation and library inside out.
>> On the other hand, you received several pieces of input for
>> documentation that could be changed quickly. Why not change them during
>> the review (easy for me to say, I know)?
> First, apologies. For taking it on you.
No problem :-)
> The last 2 weeks have be somewhat
> exhausting. Yes, the docs are not perfect... although I've been somewhat
> disappointed as I felt we've been focusing too much on documentation rather
> than the design and api. Without the latter there is no point in
> documentation.
>
> As for "why not change them during the review" I was explicitly instructed
> by my review manager not to touch the master branch during review. All the
> suggestions (code and docs) are going into the port_review branch.
OK, I was not aware of that.

>
>
>>>> And I was not (knowingly) suggesting API changes that reduce
>>>> applicability for generic programming. In fact the ability to provide a
>>>> callable to handle the conversion problems is much better suited than
>>>> returning a default value and testing for it, IMHO. It is probably also
>>>> performing better than throwing and catching exceptions.
>>> I never thought of that. It sounds potentially interesting. I myself have
>>> no
>>> experience of such deployment... Might be an overkill as so far
>>> "optional"
>>> served my purposes well... It'd be easier to see real compilable code
>>> with
>>> realistic examples... even if it is merely string->int. ;-)
>> We're using such an interface for looking up elements in a map. If the
>> key is invalid, the function is called.
>>
>> Very nice, for instance, to log and throw.
> Do you think you might post some simplified deployment example without
> divulging trade secrets and killing me with the details? :-)
>
Using one of the many suggestions for the syntax, please change to what
you end up with:

int t = boost::convert<int>::from("17", []{
   log("could not read noOfThreads");
   throw ConfigError(); });

int c = boost::convert<int>::from("17", []{
   log("could not read noOfCores, using default");
   return 7; });

Regards,

Roland


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