Itcl introspection

Itcl provides many means of introspection. Once a class has been defined and an object of that class created then the class names and objects can be found in this manner:

  package require Itcl

  itcl::class abc {
        variable a 1
        variable b
  }

  abc myobj
  abc myotherobj
  puts "Classes: [itcl::find classes]"
  puts "Objects: [itcl::find objects]"

The Itcl class manual page [L1 ] provides many more hints, such as

  myobj info variable
    ::abc::this ::abc::a

For debugging purposes, protected array variables of an object can be accessed using

  set [list @itcl myobj ::abc::b(foo)]

The namespace children command includes ::abc as a namespace since this is how Itcl implements classes.

  namespace children {} a*
    ::activestate ::abc ::auto_mkindex_parser

The methods of the object, and the body of the method can be obtained.