Re: Reloading packages: Removed[symbol]
- To: mathgroup at smc.vnet.net
- Subject: [mg57822] Re: Reloading packages: Removed[symbol]
- From: "Stefan Linnik" <- at mk-nntp-1.news.uk.worldonline.com>
- Date: Thu, 9 Jun 2005 05:18:19 -0400 (EDT)
- References: <d869d6$cf2$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi I keep some functions in a package in a file (called 'Std.m'). After altering a function(s) all I do is to re Evaluate <<Std.m in the notebook and the new defintion(s) are immediately avaliable. Not sure whether this is the same thing but I just thought I'd mention it. Stefan Linnik ~~~~~~~~ "Josef Karthauser" <joe at tao.org.uk> wrote in message news:d869d6$cf2$1 at smc.vnet.net... > > I want to reload a package that's already been loaded. (Because it's > been modified in another mathematica session and I want to take > advantage of the new functionality.) > > I thought I was being clever by first removing all the package symbols > with Remove[] and then removing the package name from $Packages. This > allows me to reload the package, but I'm left with a dilemma. > Definitions that are in memory that referenced the symbols that have > been removed have been replaced with 'Removed["symbol"]' and I can't > seem to match them to turn them back. > > Is there a way of reloading a module? How do I fix this problem? > > The string of operations to reload MyPackage was: > > Remove["MyPackage`*"] > > Unprotect[$Packages]; > $Packages = Select[$Packages, =AC StringMatchQ[#, "MyPackage`*"] &]; > > Needs["MyPackage`"] > > My problem now is effectively: > > In: a = MyPackage`Foo[] > In: Remove["MyPackage`*"] > In: a // FullForm > Out: Removed["Foo"][] > > How do I convert a back? > > In: a /. Removed[x_] :> Symbol[x] > > Doesn't do anything :(. > > Joe > -- > Josef Karthauser (joe at tao.org.uk) http://www.josef-k.net/ > FreeBSD (cvs meister, admin and hacker) http://www.uk.FreeBSD.org/ > Physics Particle Theory (student) http://www.pact.cpes.sussex.ac.uk/ > ================ An eclectic mix of fact and theory. ================= > >