View · Search · Index
No registered users in community xowiki
in last 10 minutes

Re: [Xotcl] XOTcl-copy and trace

From: Gustaf Neumann <neumann_at_wu-wien.ac.at>
Date: Fri, 04 Jan 2008 13:56:31 +0100

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