Posted to tcl by colin at Thu Feb 09 05:23:11 GMT 2012view raw

  1. trace add variable ::auto_path {read write} [list ::apply {{name1 name2 op} {
  2. variable ::_auto_path
  3. if {$op eq "read"} {
  4. if {![info exists ::_auto_path]} {
  5. set _auto_path {}
  6. }
  7. set ::auto_path auto_path:[dict keys $::_auto_path]
  8. #puts stderr [dict keys $::_auto_path]
  9. } elseif {$op eq "write"} {
  10. set ::_auto_path {}
  11. foreach n $::auto_path {
  12. dict set ::_auto_path $n {}
  13. }
  14. #puts stderr auto_path:[dict keys $::_auto_path]
  15. }
  16. }}]