Posted to tcl by colin at Wed Nov 17 01:45:08 GMT 2010view pretty
proc reader {} { ::yield } oo::class create ::Lamb { method reader {} { ::yield variable var puts stderr "Var: $var" } constructor {} { variable var 1 ::coroutine ::meh [self] reader ;# will crash #::coroutine ::meh reader ;# will not crash } } [::Lamb new] destroy foreach o [info class instances ::Lamb] { catch {info object namespace $o} e eo puts "1: $e ($eo)" } ::meh die foreach o [info class instances ::Lamb] { catch {info object namespace $o} e eo puts "2: $e ($eo)" }