Posted to tcl by colin at Wed Nov 17 23:34:17 GMT 2010view pretty
proc reader {} { ::yield } oo::class create ::Lamb { method reader {} { ::yield variable var puts stderr "Var: $var / [namespace current] / [namespace exists [namespace current]]" } constructor {} { variable var 1 set ::ns [info object namespace [self]] ::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)" } puts stderr "NS: [namespace exists $ns]" ::meh die puts stderr "NS: [namespace exists $ns]" foreach o [info class instances ::Lamb] { catch {info object namespace $o} e eo puts "2: $e ($eo)" }