Posted to tcl by colin at Wed Nov 17 23:34:17 GMT 2010view raw

  1. proc reader {} {
  2. ::yield
  3. }
  4.  
  5. oo::class create ::Lamb {
  6. method reader {} {
  7. ::yield
  8. variable var
  9. puts stderr "Var: $var / [namespace current] / [namespace exists [namespace current]]"
  10. }
  11.  
  12. constructor {} {
  13. variable var 1
  14. set ::ns [info object namespace [self]]
  15. ::coroutine ::meh [self] reader ;# will crash
  16. #::coroutine ::meh reader ;# will not crash
  17. }
  18. }
  19.  
  20. [::Lamb new] destroy
  21. foreach o [info class instances ::Lamb] {
  22. catch {info object namespace $o} e eo
  23. puts "1: $e ($eo)"
  24. }
  25.  
  26. puts stderr "NS: [namespace exists $ns]"
  27. ::meh die
  28. puts stderr "NS: [namespace exists $ns]"
  29.  
  30. foreach o [info class instances ::Lamb] {
  31. catch {info object namespace $o} e eo
  32. puts "2: $e ($eo)"
  33. }