Posted to tcl by aspect at Tue Apr 04 01:06:35 GMT 2017view pretty

coroutine coro while 1 yield
proc test {a} {
    puts "Test: $a"
    test [expr {$a + 1}]
}

for {set i 0} {$i < 998} {incr i} {
    tcl::unsupported::inject coro {incr ::j}
}
test 1
puts Finished

# Test: 1
# too many nested evaluations (infinite loop?)
#     while executing
# "puts "Test: $a""
#     (procedure "test" line 2)
#     invoked from within
# "test [expr {$a + 1}]"
#     (procedure "test" line 3)
#     invoked from within
# "test 1"
#     (file "x.tcl" line 10)