Re: "unload" a package
- To: mathgroup at smc.vnet.net
- Subject: [mg70829] Re: [mg70814] "unload" a package
- From: "Chris Chiasson" <chris at chiasson.name>
- Date: Sat, 28 Oct 2006 23:38:04 -0400 (EDT)
- References: <200610280921.FAA16109@smc.vnet.net>
To be clear: I didn't make the other fourm (though I wish I had, so I could have control). Also, Needs will not reload a package that appears in $Packages, even if its definitions have been erased. You may want to check to see what other packages are loaded by Graphics`Graphics`. On 10/28/06, dimitris <dimmechan at yahoo.com> wrote: > Hello to all. > > I wondered how someone can "UNLOAD" a package > without "kill" the Kernel? > > That is, is there a command that does the opposite of Get or Needs? > > After the Chriss Chiasson and David Park's responses (thanks a lot both > of you!!!) and their suggestion for using Remove I tried to experiment > myself, practise which resulted in a bigger query. > > Before proceeding to my question Copy/Paste the > following in a notebook, select the Cells and execute the commands. > > ---------------------------------------------------------------------------------------------------------- > > Print[StyleForm["Version I work", FontColor -> Blue, FontWeight -> > "Bold"]] > $Version > > Print[StyleForm["Load the package", FontColor -> Blue, FontWeight -> > "Bold"]] > Needs["Graphics`Graphics`"] > > Print[StyleForm["Built-in Symbols inside the package", FontColor -> > Blue, > FontWeight -> "Bold"]] > Names["Graphics`Graphics`*"] > > Print[StyleForm["An example", FontColor -> Blue, FontWeight -> "Bold"]] > DisplayTogether[Plot[x, {x, 1, 2}], Plot[2*x, {x, 1, 2}]]; > > Print[StyleForm["Remove all the Built-in Symbols\nof the package from > the Kernel", FontColor -> Blue, FontWeight -> "Bold"]] > Remove["Graphics`Graphics`*"] > > Print[StyleForm["Check", FontColor -> Blue, FontWeight -> "Bold"]] > Information["Graphics`Graphics`*", LongForm -> False] > > Print[StyleForm["Reload the package", FontColor -> Blue, > FontWeight -> "Bold"]] > Needs["Graphics`Graphics`"] > > Print[StyleForm["Built-in Symbols inside the package", FontColor -> > Blue, > FontWeight -> "Bold"]] > Names["Graphics`Graphics`*"] > Print[StyleForm["!!!", FontColor -> Blue, FontWeight -> "Bold"]] > > Print[StyleForm["Kill the Kernel", FontColor -> Blue, FontWeight -> > "Bold"]] > Quit > > Print[StyleForm["Re-re-load the package (...)", FontColor -> Blue, > FontWeight -> "Bold"]] > Needs["Graphics`Graphics`"] > > Print[StyleForm["Built-in Symbols inside the package", FontColor -> > Blue, > FontWeight -> "Bold"]] > Names["Graphics`Graphics`*"] > > Print[StyleForm["Kill the Kernel", FontColor -> Blue, FontWeight -> > "Bold"]] > Quit > > Print[StyleForm["Re-re-re-load the package (...)", FontColor -> Blue, > FontWeight -> "Bold"]] > Needs["Graphics`Graphics`"] > > Print[StyleForm["Built-in Symbols inside the package", FontColor -> > Blue, > FontWeight -> "Bold"]] > Names["Graphics`Graphics`*"] > > Print[StyleForm["Clear all the Built-in Symbols\nof the package from > the Kernel", > FontColor -> Blue, FontWeight -> "Bold"]] > Clear["Graphics`Graphics`*"] > > Print[StyleForm["Check I", FontColor -> Blue, FontWeight -> "Bold"]] > Information["Graphics`Graphics`*", LongForm -> False] > > Print[StyleForm["Check II", FontColor -> Blue, FontWeight -> "Bold"]] > DisplayTogether[Plot[x, {x, 1, 2}], Plot[2*x, {x, 1, 2}]] > > Print[StyleForm["Check III", FontColor -> Blue, FontWeight -> "Bold"]] > Needs["Graphics`Graphics`"] > Print[StyleForm["Again problem", FontColor -> Blue, FontWeight -> > "Bold"]] > DisplayTogether[Plot[x, {x, 1, 2}], Plot[2*x, {x, 1, 2}]] > > --------------------------------------------------------------------------------------------------------------- > > And here comes my question! > > Ok, with Remove["Graphics`Graphics`*"] you avoid to refresh the Kernel > in order to "unload" (...somehow..) the package. > > However, in order to reload again the package you MUST refresh the > Kernel! > BUT, this is what I want to avoid! > > The same holds true, more or less, for Clear. > > Anyway for those that are interested in the subject, > there is forum for Mathematica (I think Chris Chiasson is responsible > for it; see http://groups.google.com/group/mathematica) > and look what someone answered me: > > "I think that there is no reliable way to do this. > However, take a look at the CleanSlate package in > ExtraPackages/Utilities. The documentation is inside the CleanSlate.m > file. But keep in mind that this package is not very reliable. > You can also read about contexts. The functions imported from packages > usually reside in their own context." > > What do you believe? > > I really appreciate any guidance/further insight. > Thanks in advance for any response > > Dimitris Anagnostou > > -- http://chris.chiasson.name/
- References:
- "unload" a package
- From: "dimitris" <dimmechan@yahoo.com>
- "unload" a package