Posted to tcl by lyon at Tue Feb 19 19:50:17 GMT 2013view raw

  1. # proc F {} {}
  2.  
  3. proc test {} {
  4. set script {
  5. proc F {call} {
  6. puts stdout "$call -> [namespace current]"
  7. }
  8. }
  9. #
  10. namespace eval ::A {}
  11. namespace eval ::A [subst {
  12. $script
  13. F 1
  14. }]
  15. #
  16. namespace eval ::A::B {
  17. namespace path ::A
  18. }
  19. namespace eval ::A::B [subst {
  20. $script
  21. F 2
  22. }]
  23. #
  24. namespace eval ::A::B {
  25. F 3
  26. }
  27. }
  28.  
  29. test
  30.