[self proc] inside a method that has been called inside an [ob eval] block gives the result "eval" inside of the method we're in.
In practise this is now causing so many headaches I think I'm going to give up on doing this package using XOTcl that way. There appears to be no (working?) way to run a script within the 'context' of an object, in order to easily parse data which is formed in the style of a Tcl script. This is unfortunate as it would likely have offered clear performance benefits.
I may still try to do it directly with normal namespaces instead of XOTcl.
On Monday 06 September 2004 15:51, Kristoffer Lawson wrote:
[self proc] inside a method that has been called inside an [ob eval] block gives the result "eval" inside of the method we're in.
actually, i do not find it surprising, that "self proc" returns "eval", since self proc returns the topmost xotcl-method from the xotcl call stack. If one calls the XOTcl "eval" method, it performs the tcl-eval to execute (without the xotcl dispatcher) the presented tcl script. Therefore the xotcl stack is not aware of the actual tcl commands at and returns the topmost method, namely "eval".
It looks to me that you can use [info level 0] instead, which operates on the tcl stack.
~/scripts> o proc p {} {puts [self]-p-[info level 0]} ~/scripts> o p ::o-p-p ~/scripts> o eval p ::o-p-p
In practise this is now causing so many headaches I think I'm going to give up on doing this package using XOTcl that way. There appears to be no (working?) way to run a script within the 'context' of an object, in order to easily parse data which is formed in the style of a Tcl script. This is unfortunate as it would likely have offered clear performance benefits.
If you have some some code, we can look at, we will certainly try to help with that.
-gustaf
I may still try to do it directly with normal namespaces instead of XOTcl.
/ http://www.fishpool.com/~setok/
Xotcl mailing list - Xotcl@alice.wu-wien.ac.at http://alice.wu-wien.ac.at/mailman/listinfo/xotcl
On Tue, 14 Sep 2004, Gustaf Neumann wrote:
In practise this is now causing so many headaches I think I'm going to give up on doing this package using XOTcl that way. There appears to be no (working?) way to run a script within the 'context' of an object, in order to easily parse data which is formed in the style of a Tcl script. This is unfortunate as it would likely have offered clear performance benefits.
If you have some some code, we can look at, we will certainly try to help with that.
I'm actually working on a package built on top of normal [binary] which would allow a clearer definition of the format of the binary data. Something like:
byenary::scan $data { option endian little type cellObject { short objID int8 triByteNum
int8 $triByteNum triVisibility }
format { object root { short objNum short triNum
cellObject $objNum objects }
object * children { short objID short objNum short triNum
cellObject $objNum objects } } }
The aim is then that it returns a hierarchy of objects to represent the data. I actually made a version already, but it parses that format description manually and continuously. Even if I split the script into lists, I still have to go through that. The format description is intentionally made to look like a Tcl script with the idea that later I could evaluate it in the appropriate context and let Tcl do the work (and also byte compile it).
Now I'm thinking about doing that not by XOTcl mechanisms but namespaces. Perhaps that could be the best option.