I was thinking of just a method on the Coroutine PMC so you could do
.sub some_global_coroutine .yield(1) .yield(2) .yield(3) .yield(4) .yield(5) .end .local pmc mycoro # create the coroutine mycoro = global 'some_global_coroutine' mycoro = clonoe mycoro .local pmc corresult # call it a few times corresult = mycoro() # 1 corresult = mycoro() # 2 corresult = mycoro() # 3 mycoro."reset"() # reset the coroutine corresult = mycoro() # 1 again (not 4) But maybe this was already possible, I don't know. I'm not familiar with the implementation specifics of a Coroutine, but it seems to me it shouldn't be too hard. Kind regards, klaas-jan On 5/29/06, Elizabeth Mattijsen <[EMAIL PROTECTED]> wrote:
At 11:04 PM +0200 5/29/06, Klaas-Jan Stol wrote: >I couldn't find any functionality to reset a coroutine. Sometimes you want >to reset a coroutine, so it starts at the beginning of the sub body, but >there doesn't seem to be any method to do that. Am I overlooking something? Good point. Essentially you would be removing the continuation context of that subroutine / method. A method on a method maybe? foo.reset( bar => 1 ); comes to mind? Suggestions? Comments? Liz