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

trace add variable ::auto_path {read write} [list ::apply {{name1 name2 op} {
    variable ::_auto_path
    if {$op eq "read"} {
	if {![info exists ::_auto_path]} {
	    set _auto_path {}
	}
	set ::auto_path auto_path:[dict keys $::_auto_path]
	#puts stderr [dict keys $::_auto_path]
    } elseif {$op eq "write"} {
	set ::_auto_path {}
	foreach n $::auto_path {
	    dict set ::_auto_path $n {}
	}
	#puts stderr auto_path:[dict keys $::_auto_path]
    }
}}]