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

XOTcl/NX mailing list by object move?

From: Koen Danckaert <koen_at_retarget.com>
Date: Mon, 20 Mar 2006 13:05:59 +0100

Gustaf Neumann wrote:
>>
>> proc myproc {args} {linsert $args 0 [uplevel 1 self]}
>> proc myvar {var} {return [uplevel 1 self]::$var}
>
> as kristoffer noted (and as in my earlier version shows)
> it makes sense to add a requireNamespace to myvar.

I usually put the requireNamespace in the "init" method (when it's needed). But I agree that the overhead of putting it in myvar would be negligible.

>> trace add variable [myvar status] write [myproc statusevent]
>
> you can use here as well
>
> my trace add variable status write [myproc statusevent]

Ah, ok, I'm used to the forwarders for lappend/unset etc, but didn't notice about trace yet. I now see that there is one for vwait, too.

> Shouldn't we use "mymethod" instead of myproc, this function will not
> only work for procs, but for instprocs and cmds as well....

I used myproc because the name "method" isn't used anywhere in XOTcl.
But indeed, myproc seems to indicate that it only works for procs, which is wrong of course.

Koen