petdance/scratch — Issue #1226: Cannot resume dead coroutine
Author: petdance
Created: 2011-11-01 05:39:39+00:00
State: open
Labels: bug, Pri-normal, Sev-medium

{{{
.sub 'MyCoro'
.yield(1)
.yield(2)
.yield(3)
.return(4)
.end

.sub 'main' :main
$I0 = MyCoro()
say $I0
$I0 = MyCoro()
say $I0
$I0 = MyCoro()
say $I0
$I0 = MyCoro()
say $I0
$I0 = MyCoro()
say $I0
$I0 = MyCoro()
say $I0
$I0 = MyCoro()
say $I0
.end
}}}

prints:

{{{
1
2
3
4
Cannot resume dead coroutine.
current instr.: 'main' pc 35 (coro.pir:11)
}}}

on parrot-2.5.0-devel on Mac OS X 10.5.8.

I think the subroutine should restart, since the user of the sub doesn't care whether it's a coroutine or not.

Originally http://trac.parrot.org/parrot/ticket/1702