I am recently attempting to upgrade to TCL 8.6 (Yeah, several years late) from 8.5. I am running into an issue auto loading our itcl classes. In a number of our classes, we store the class methods in different files from the file with the class definition. Auto load was happy to handle this. In TCL 8.6, itcl is running into an issue auto loading the class methods. The class definition is autoloaded correctly, though. Is it still possible to have itcl autoload the class methods outside of the class definition file? If I call auto_load directly, the method will be loaded.
Note that for the example below, I did hand create the tclIndex file and it is not stored in auto_path.
testClass Definition File testClass.tcl
itcl::class testClass {
constructor {args} {}
destructor {args}
public method foo {}
}
itcl::body testClass::constructor {args} {
puts "Created testClass"
}
itcl::body testClass::destructor {args} {
}
testClass Foo method Definition File testClassFoo.tcl
itcl::body testClass::foo {args} {
puts "Bar"
}
tclIndex File
set dir /opt/tclClassTest
set auto_index(testClass) [list source [file join $dir testClass.tcl]]
set auto_index(::testClass::constructor) [list source [file join $dir testClass.tcl]]
set auto_index(::testClass::destructor) [list source [file join $dir testClass.tcl]]
set auto_index(::testClass::foo) [list source [file join $dir testClassFoo.tcl]]
testCode
% puts $tcl_version
8.6
% package require itcl
4.2.1
% source /opt/tclClassTest/tclIndex
source /opt/tclClassTest/testClassFoo.tcl
% testClass t1
Created testClass
t1
% t1 foo
member function "::testClass::foo" is not defined and cannot be autoloaded
% auto_load ::testClass::foo
1
% t1 foo
Bar
%