[Xotcl] Question on [eval] method

Kristoffer Lawson setok at fishpool.com
Mon Sep 6 16:02:12 CEST 2004


On Mon, 6 Sep 2004, Uwe Zdun wrote:

> I'm not pretty sure, what you want to reach here. The "eval" method provided 
> by XOTcl does nothing
> else then a Tcl eval in the context of the object's namespace. This is not 
> meant for evaluating
> methods, though it accidently works for local methods (procs), because they 
> are defined
> in the same namespace.

OK, thanks. This is the information I was after. Ie. I should not assume 
that, though it might be kind of cool if there was a way to do what I was 
thinking.

> In the example below, I would define the " commands" 
> such as 'format', 'short', 'object'
> as objects. Then you can use Tcl's eval to send messages to these objects, 
> and define the first argument
> as method or use "unknown".

Then I actually gain very little compared to doing it inside namespaces. 
It would've helped for the methods to know their context and also for 
variables to be used (my first version did all this work manually). I can 
still get that with directly manipulating Tcl namespaces, I think, but 
it's just a tad more awkward than what I thought I'd get with XOTcl 
objects (because I also have to create structures and objects for my 
parser -- using namespaces instead of XOTcl obs).

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



More information about the Xotcl mailing list