Version 7 of Tcl Modules

Updated 2005-10-13 10:38:30

Purpose: Discuss the purpose, and implementation, of TIP#189 [L1 ], TIP#190 [L2 ], and TIP#191 [L3 ] . Note this is something totally different from the Tcl Modules package.


See also Tcl Module creation script


See tarpack for an experiment in tar archives that are also sourceable Tcl Modules.


Could Tcl Software Libraries be relevant in discussing this topic?


LV I've seen people ask whether zip files will be supported as tcl modules; I myself am hoping to see starkits as tcl modules.


jmn 2005-09-13 ::tcl::tm::add can have unintuitive (IMO) results. tip189 clearly states that paths added last are 'looked at' first - but it doesn't make it clear that a package of the same version in a later path will 'override' the earlier entry in the 'package ifneeded' database.

This may be of concern if you are trying to create a local cache of packages with a fallback to your main repository on a (slower) network share - or if you are trying to force use of a particular module file during testing (without hacking at versions).

'package forget' won't help here - in contrast to the standard auto_path system where a path inserted into the head of $auto_path WILL allow loading of this package in preference to the one found later in the list (assuming either auto_path wasn't scanned prior to the addition, or you've called 'package forget' after the addition) .

Is this behaviour intended?

I think it'd be really nice to have some way (that works consistently for both module & auto_path systems) to override existing entries in the 'package ifneeded' database - for just those packages in a particular folder.

e.g a 'package scan <dir>' command might add just the packages found in <dir> - replacing any previous entries in the database.

Otherwise - some better introspection of the 'package ifneeded' database would be nice.. It's currently quite confusing to debug package loading issues so if you could do something like a 'package ifneeded *' and see what it holds - that might help.

Lars H: Do you mean something like this?

 proc package_ifneeded_* {} {
    set res {}
    foreach pkg [package names] {
       set L {}
       foreach ver [package versions $pkg] {
          lappend L $ver [package ifneeded $pkg $ver]
       }
       lappend res $pkg $L
    }
    set res
 }

Example:

 % join [lrange [package_ifneeded_*] 0 5] \n
 rcs
 0.1 {source /Library/Tcl/tcllib1.8/rcs/rcs.tcl}
 logger
 0.6.1 {source /Library/Tcl/tcllib1.8/log/logger.tcl}
 SOAP::Utils
 1.0 {source /Library/Tcl/tclsoap1.6.7/utils.tcl}

Category Deployment