Posted to tcl by colin at Wed Nov 17 01:23:05 GMT 2010view raw
- namespace eval tcl::unsupported namespace export yieldm
- namespace import tcl::unsupported::yieldm
- proc reader {} {
- while {1} {
- ::yieldm
- }
- }
- oo::class create ::Lamb {
- method reader {} {
- while {1} {
- ::yieldm
- }
- }
- constructor {} {
- variable ns [info object namespace [self]]
- variable coro ${ns}::coro
- ::coroutine $coro [self] reader ;# will crash
- #::coroutine $coro reader ;# will not crash
- }
- }
- [::Lamb new] destroy
- foreach o [info class instances ::Lamb] {
- if {[catch {info object namespace $o} ns]} {
- error "$o is undead"
- }
- }