Version 3 of package forget

Updated 2004-02-05 10:48:38

package forget ?package package ...?

Removes all information about each specified package from this interpreter, including information provided by both package ifneeded and package provide.


See also:


RS 2004-02-05: package forget does not remove resources that a package has brought with it. I'm not sure whether it unloads a DLL (8.5 will have unload), but I could verify that it does not remove namespaces created by a package. Now if a package is well-behaved (i.e. creates a single namespace named like itself, in which all variables, commands, and possible child namespaces go), the cleanup could be done with

  namespace delete ::pkgName

Unloading could be combined with this:

 namespace eval ::pkgName {
   set unload {}
   trace var pkgName::unload u {unload pkgName[info sharedlib] ;#}
 }

Is that so?


Tcl syntax help - Category Command