[vtk-developers] mccases.tcl
Sebastien BARRE
sebastien at barre.nom.fr
Wed Aug 22 18:00:54 EDT 2001
Hi Will, Bill, Berk, John,
At 22/08/2001 10:05, Will Schroeder wrote:
>and the script will find it. (You don't need both the "package require
>vtktcl" and "package require vtktcl_mccases" because mccases requires vtktcl.)
In that case, feel free to add :
package require vtktcl
in the vtktcl_mccases package, just as I did in vtktcl_interactor. If
vtktcl has already been loaded there won't be any penalty anyway.
John, what's backdrop.tcl in Wrapping/Tcl ?
I'm not sure that we should add a package for every single additional Tcl
script... Don't forget that you can still use the
::vtktcl::package_index_dir variable, it's available everywhere once the
vtktcl package has been loaded, and it will always point to Wrapping/Tcl.
You can use it to source your file for example (see how it's done in
pkgIndex.tcl). It costs you the same number of line of code (i.e. 1), but
this prevent us from adding a new package in pkgIndex.tcl.
The standard Tcl practice is that we should try to leave pkgIndex.tcl as
*stable* (i.e. untouched) and *small* as possible. Let me go straight to
the point : remember that even if you *do not* use VTK *at all*,
pkgIndex.tcl has an impact on *everyone* using Tcl on your system. If this
file is big, then it slows *everyone*. If it crashes, it can crash *every*
single script using a 'package require' call, not only a 'package require
vtktcl'. Remember that once a 'package require' call is issued, Tcl parses
*all* pkgIndex.tcl files found in $auto_path. Put an error in VTK's
pkgIndex.tcl and try 'package require foobar' for example.
I can also add a ::vtk::load_script proc (just as ::vtktcl::load_component)
that could be used to load a script in Wrapping/Tcl. Thus, instead of :
package require vtktcl
package require vtktcl_mccases (which is cool, I know)
you could use:
package require vtktcl
::vtk::load_script mccases
John, Will, what do you think ?
More information about the vtk-developers
mailing list