Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-11-02 08:01:46


Thorsten Schuett wrote:
> On Tuesday 01 November 2005 20:11, Peter Dimov wrote:
> [snip]
>>> However, the active lambda stuff could possibly be done as an
>>> extension of Boost.Lambda using Spirit/Phoenix sugar:
>>>
>>> future< int > = active<>[ _1 = _1 + 2 ];
>>
>> This doesn't work; your active<> doesn't take any arguments, so you
>> can't use _1. It is possible to make this:
>>
>> future<int> f1 = active( bind( f, 1, 2 ) );
>> future<int> f2 = active( bind( &X::f, &x, 1, 2 ) );
>>
> What is the point of adding the active-Wrapper? The bind already
> returns a nullary function.
>
> future<int> f1 = bind( f, 1, 2 );
>
> should be sufficient.

'active' is not a wrapper, it's a function taking a function object and
returning a future.

I haven't looked at your 'future' design too closely (if at all) but I think
that what you call 'future' is a future and an executor rolled into one.

In the "classic" design a future is a passive result holder and the actual
computation of the result is done by the executor. A future by itself does
not spawn any threads and doesn't even know about threads. It's a "ticket"
for a future value that you can "redeem" at some point.


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