$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [coroutine] interface suggestion
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-09-20 07:25:49
Le 20/09/12 13:05, Oliver Kowalke a écrit :
>> - Why do you need to explicitly bind? If you are required to bind the
>> arguments of the coroutine-fn anyway, the trampoline might as well do it
>> for you.
> bind() in the sense to get the address. with the address I can store new values in the variable.
>
>> - As you described, you need to provide an alternate interface (i.e.
>> get())
> get() should not be provided
>
>
>> - Tying the caller_t to an object in the coroutine stack (the parameters),
>> makes it very hard to move the caller object to another coroutine. This is
>> important to implement pipelines, where yield does not return to the
>> caller
>> but the next coroutine in the pipeline.
> let us keep the library simple - chains of coroutiens will causes many problems
>
>
>> How would you exactly rebind references?
> references are pointers == addresses - in the case I get the address of the pointer and store tat this place the address of the new value
>
>
>> int i = 0, j = 0;
>> coroutine<void(int&)> coro([&](caller_t& caller, int& x) {
>> caller.bind(x);
>> assert(&x == &i); // ok
>> caller.yield();
>> assert(&x == &y); // ?????
>> });
>>
>> coro(i);
>> coro(j);
> caller.bind(x); // get address of the reference of x which contains the address of i
> caller.yield(); // in this call I store the address of j at the address of reference of x.
>
Unfortunately, this shouldn't work. You can change the contents of a
reference but not the reference itself. But maybe you have found how to
workaround the compiler semantics.
Best,
Vicente