Hi,
What is the equivalent of building a tclIndex file for xotcl classes? I want to build an app which is comprised of a whole bunch of modules. I'd like the modules to be automatically loaded when I call one of the classes defined in them. The way I do it now is:
source "module1.tcl" source "module2.tcl" . . .
There is most likely a better way but I'm not sure what it is.
Thanks,
L
"LD" == Laurent Duperval laurent.duperval@netergynet.com writes:
LD> Hi, LD> What is the equivalent of building a tclIndex file for xotcl classes? I want LD> to build an app which is comprised of a whole bunch of modules. I'd like the LD> modules to be automatically loaded when I call one of the classes defined in LD> them. The way I do it now is:
LD> source "module1.tcl" LD> source "module2.tcl" LD> . LD> . LD> .
Hi,
we use nearly always tcl's package command with tclIndex files. Take a look at the examples in src/lib and packages/ ...
e.g. xodoc.xotcl in src/lib declares:
package provide xoDoc 0.82
which is used by makeDoc.xotcl:
package require xoDoc
XOTcl uses an env variable TCLLIBPATH to customize the load path or you can use auto_path. Same as with Tcl you have to run pkg_mkIndex, when something changes.
Alternatively OTcl (and XOTcl) offers autoloading of classes (see lib/testo.xotcl for an example -- search for autoload). But this has too often turned out ot be problematic, because you don't have fine grained control of how things are loaded. The abstraction into a whole package seems to better fit the reusable component idea. And it lets you build and load .xotcl, .tcl, and .so/.dll components in the same way ... even if they're constructed from other components.
--Uwe