AW: [Xotcl] destroy invoked by object move?

Koen Danckaert koen at retarget.com
Mon Mar 20 11:10:28 CET 2006


> Snit has a "myvar" method that returns the fully qualified name of a 
> snit member variable.  Perhaps something similiar (a method that 
> returned a "reference" to an instance variable) would be useful in XOTcl?  

I use the following two global procs for that:

    proc myproc {args} {linsert $args 0 [uplevel 1 self]}
    proc myvar {var} {return [uplevel 1 self]::$var}

The procs are global (not instprocs on "Object") because otherwise I would have to write "my myvar" or "my myproc". Now I can simply use them in the following way inside xotcl (inst)procs:

    button $x -command [myproc show 1 2 3]
    ...
    trace add variable [myvar status] write [myproc statusevent]
    ...
    vwait [myvar done]


(Note: in fact the "uplevel" in the definition of myproc/myvar is not even necessary. It seems that [self] always refers to the last Xotcl object on the callstack.)

Koen



More information about the Xotcl mailing list