Re: Package unloading



Derek Fountain wrote:
I have a package containing a file call foo.tcl, which contains a whole bunch of Tcl procedures I'm working on. I start a tkcon, package require mypackage, do my thing, then go back to my editor for further work on foo.tcl. Then I run 'make install' to get the latest foo.tcl into place.

Then, I need to exit tkcon and restart it, and package require again to get the latest Tcl code into the interpreter. Is there a way I can unload foo.tcl and reload it from disk without restarting the interpreter?

Your question is confusing.

What is the relationship between the file "foo.tcl" and the package
"mypackage" ?

[package forget mypackage] will reset the interp to no longer know it
contains the "mypackage" package and to also forget anything it knows about what versions of "mypackage" are available. Then the next [package require mypackage $requirement] will bring in the most suitable version of mypackage available satisfying $requirement, with a fresh call to [package unknown] to figure that out.

The exact effect of [package require]-ing a new version of "mypackage"
over the top of its [package forg<o>t]ten predecessor depends on the
details of how "mypackage" is written.

--
| Don Porter Mathematical and Computational Sciences Division |
| donald.porter@xxxxxxxx Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|
.



Relevant Pages

  • Re: importing external class from inside package
    ... we write the statement - 'package mypackage' in each of those ... Then we complied all the java files: ... of MyInterface class in the First.java. ...
    (comp.lang.java.help)
  • Re: Package unloading
    ... I have a package containing a file call foo.tcl, which contains a whole bunch of Tcl procedures I'm working on. ... Then, I need to exit tkcon and restart it, and package require again to get the latest Tcl code into the interpreter. ...
    (comp.lang.tcl)
  • Re: Several question about select.
    ... I realy don't know what correct newsgroup, ... package mypackage is ... res number; ...
    (comp.databases.oracle.misc)
  • configurable variables in own file?
    ... Dear perl experts: I want to create a rather lightweight package that ... just uses what is installed in standard perl. ... mypackage, I think it would be nice to have such variables layed out ...
    (comp.lang.perl.misc)
  • Re: configurable variables in own file?
    ... I want to create a rather lightweight package that ... just uses what is installed in standard perl. ... mypackage, I think it would be nice to have such variables layed out ... pure-Perl (they don't require a compiler to install) and have no ...
    (comp.lang.perl.misc)