[Xotcl] XOTcl-copy and trace

Gustaf Neumann neumann at wu-wien.ac.at
Fri Jan 4 13:56:31 CET 2008


Dear Florian,

tcl var-traces and copy/move operations is a hairy issue.
You are right, the the current behavior on the issue
is a bug. I can't currently look into the details (i am on vacation
in a small place in the alps until Jan 6), but my guess is that
the behavior was introduced by the changes due to
VarReform.

Use the following fix in the meantime, until i have
more time to look into the details (insert this code before
the first copy).

best regards
-gustaf neumann

Class PreserveVarTraces
PreserveVarTraces instproc copy {obj dest} {
  set traces ""
  foreach v [$obj info vars] {
    set t [$obj trace info variable $v]
    if {$t ne ""} {
      foreach ops $t {
    foreach {op cmd} $ops break
    append traces [list $obj trace add variable $v $op $cmd] "\n"
      }
    }
  }
  set r [next]
  eval $traces
  return $r
}
::xotcl::Object::CopyHandler instmixin add PreserveVarTraces





More information about the Xotcl mailing list