
On Wed, Sep 19, 2012 at 7:58 PM, Vicente J. Botet Escriba < vicente.botet@wanadoo.fr> wrote:
Le 19/09/12 18:21, Giovanni Piero Deretta a écrit :
On Wed, Sep 19, 2012 at 2:20 AM, Vicente J. Botet Escriba <
vicente.botet@wanadoo.fr> wrote:
Hi,
I didn't know that Oliver was for the thread specific object design.
I'm not sure the alternative I proposed is the best one. Compile type safety is too important to be lost. Unfortunately I don't have a solution that is type safe and that avoid to pass an additional parameter to the coroutine function.
Why do you feel it is important not to pass the additional parameter?
I don't know which will be the good interface to provide coroutines by the language itself, but I think that there will not have such a parameter. I wanted to be as close as possible to this hypothetic interface. The same reason was the origin of the bind suggestion.
I do not think it follows. Consider that: - most of the languages with with coroutines/generators are dynamically typed (python, lua), so all coroutine are of the same type: no type mismatch. Still, those with callcc (scheme, ruby) explicity pass the continuation to the callee. - many languages only allow yielding from the coroutine-fn itself (i.e. are stackless), so the compiler can figure out the correct signature (C#, F#) - many modern functional languages have delimited continuations, whose shift and reset operators explicitly pass around the continuation object. -- gpd