mail@xdobry.de schrieb:
Hi Scott!
Indeed move in XOTcl is copy+destroy and it is implemented in XOTcl itself.
... After I have discovered, what indeed move is, I have changed the implementation. I think it is a little trap in XOTcl, because many user thinks it is magic fast and do not really destory objects. Indeed it is quite expensive.
note, that there is no "namespace rename" command in tcl as well. Since xotcl uses tcl namespaces, in the general case a rename command requires to handle all references (and pointers in C) to namesspaces (including traces, tcl-command names, aliases, namespace imports, nested namespaces, ...), when a namespace (with all its children) is renamed. Therefore in general, a "namespace rename" is much more expensive than a "command rename". note, that tcl has no "variable rename" command as well. So, adding such a functionality would require some amount of C hacking and quite a strong coupleing with the tcl internals.
The implementation of move as copy+destroy is a compromise between simplicity and functionality. I can imagine cases, where one wants to have more or less the equivalent to a copy constructor when copy occurs and maybe something different when a move happens. However, since all methods are equal in xotcl, it is quite simple for a poweruser of xotcl to overload copy/move and add applicaton specific addtional behavior to it. if one does not like the side-effects of destroy in a move, a custom move operation can set in instance variable "__during_move__" and query this from the destroy method to change its behavior.
hope, this helps...
-gustaf neumann
Artur _______________________________________________ Xotcl mailing list Xotcl@alice.wu-wien.ac.at http://alice.wu-wien.ac.at/mailman/listinfo/xotcl