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

XOTcl/NX mailing list by object move?

From: Kristoffer Lawson <setok_at_fishpool.com>
Date: Mon, 20 Mar 2006 12:17:09 +0200

On 20 Mar 2006, at 12:10, Koen Danckaert wrote:

>> 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:

Aren't you forgetting the [requireNamespace] from the above code?

            / http://www.fishpool.com/~setok/