Matt Fowles wrote:
I disagree with that analysis.  Let us consider the actual effect of
such an implementation.

First iteration

i = 0;
foo(); #at this point a continuation created capturing i=0, promoted
by Jens and stuff happens
#eventually it is invoked, restoring i=0
i++; #i = 1
foo(); #at this point a NEW return continuation is created capturing

That would work if there is a one to one representation of the invoation of foo() an it's continuation. But no one guarantees that.


By repeatedly invocing the continuation you alway get to the opcode after invoke, and registers would be restored to some earlier state.

...  If foo's algorithm had an error and did not use the new
return continuation to recreate its internal continuation each time,
then you would be correct.  But that would be a bug in the
implementation of foo.

Why? If foo's implementation is changed internally to double it's work per call, it could indicate that progress by returning twice through the same continuation.


E.g.

  unless done
     (done, result) = foo()
     s .= result

leo



Reply via email to