[Xotcl] Re: [Xotcl] Packaging question

uwe.zdun@uni-essen.de uwe.zdun@uni-essen.de
Mon, 11 Dec 2000 17:47:31 +0100 (CET)


>>>>> "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



-- 
Uwe Zdun
Specification of Software Systems, University of Essen
Phone: +49 201 81 00 332, Fax: +49 201 81 00 398
zdun@xotcl.org, uwe.zdun@uni-essen.de