Boost logo

Boost :

Subject: Re: [boost] Boost.Fiber review January 6-15
From: Agustín K-ballo Bergé (kaballo86_at_[hidden])
Date: 2014-01-21 22:05:34


On 21/01/2014 11:39 p.m., Nat Goodspeed wrote:
> On Wed, Jan 15, 2014 at 8:56 PM, Agustín K-ballo Bergé
> <kaballo86_at_[hidden]> wrote:
>
>> - The lack of a variadic constructor for `fiber` and variadic arguments for
>> `async` makes it difficult to use the library correctly (even in the
>> presence of C++14 lambdas). The semantic of those calls is that of a
>> deferred call, which is difficult to achieve otherwise (note that `bind`
>> doesn't help here).
>
> The review report (which I am writing now!) does not depend on my
> understanding this point, but on rereading your mail I realized I do
> not yet understand it. In my (obviously incomplete) mental model, a
> hypothetical fiber constructor:
>
> fiber f(some_callable, 3.14, "a string", 17);
>
> would be completely equivalent to:
>
> fiber f(bind(some_callable, 3.14, "a string", 17));
>
> What am I missing? (If this is already well-explained elsewhere, I
> would appreciate a pointer as much as your own explanation.)

You are missing the support for movable-only type, or the unnecessary
copies otherwise. And since you ask for a link, here is one to my own blog:

http://talesofcpp.fusionfenix.com/post-14/true-story-moving-past-bind

> Oliver may well understand your point already. But if you asked me to
> implement a variadic fiber constructor (and async() function), I would
> immediately forward to bind() inside each. Would that be a sufficient
> implementation? If not, why not?

Here is another link on the subject:

http://stackoverflow.com/a/21066704/927034

> A broader question to those who requested a variadic fiber constructor
> (and async()): is it sufficient to provide that support only when the
> compiler supports variadic templates, or are you asking for the whole
> ugly C++03 workaround as well?

C++03 support would be nice. Personally, I would be ok with only
variadic support, as long as it works on the latest versions of the
major compilers (MSVC is the only one where this presents a challenge).

Regards,

-- 
Agustín K-ballo Bergé.-
http://talesofcpp.fusionfenix.com

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