Posted to tcl by colin at Wed Nov 17 23:40:47 GMT 2010view pretty

namespace eval foo {
    proc bar {} {
	while {1} {
	    variable v
	    puts [incr v]
	    yield
	}
    }
}

coroutine ::coro ::foo::bar
namespace delete ::foo

while {1} {
    ::coro
}