Version 4 of itcl::code

Updated 2006-12-28 12:21:17

Can be used to access parts of an itcl object, even if it is private.

This seems very dangerous to me - perhaps you should consider not using this.

[This is used frequently - someone want to explain why and when it is needed?]

Isn't this just the Itcl counterpart to namespace code ?

GWM The namespace code page says that it is a constructor for namespace inscope; inscope says "This command is not expected to be used directly by programmers". Thus I would expect that itcl::code should also not be used by (end user) programmers, although the construct might be used in supplied Tcl packages. The purpose of declaring a variable 'private' is to assure the programmer that there can be no unexpected modifications of the variable other than through the class interface methods.

APW My use of itcl::code is when I have a callback for example for a widget and I want to execute that callback in the "environment" of an itcl class method even if that method is not public. That normally means, that I also install the callback from within that "environment".


Category Command part of the itcl extension Category Object Orientation