Re: Unloading packages
- To: mathgroup at smc.vnet.net
- Subject: [mg32544] Re: Unloading packages
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Sat, 26 Jan 2002 04:08:05 -0500 (EST)
- References: <a2r4a3$9oj$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Sseziwa,
Firstly: to reload a package use Get not Needs (needs is designed not to
load already loaded packages.
You may still find that you get messages about symbols being protected -
and these mean that you cannot make new definitions.
Two ways out of this
1....
At the end of the package between End[] and EndPackage[] you should find
some instructions like Protect[...]: comment these out thus
(*Protect[...]*).
(when you have finished revising remove (* and *).
2.... to do with package style:
After BeginPackage[...] insert in a new line
Unprotect["`*"]
(I also add ClearAll["`*"])
These will unprotect all the symbols in the package context and will clear
all definions and attributes associated with them.
Incidentally instead of using Protect[ < sequence of symbols>] we can use
Protect["`*"]
There are cases where we need to refine the above, for example when dealing
with symbols from other contexts or when we do not want to protect some
symbols, but I find it very convenient.
--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565
"Sseziwa Mukasa" <mukasa at jeol.com> wrote in message
news:a2r4a3$9oj$1 at smc.vnet.net...
> Is is possible to unload packages or have the functions therein be
> reread from the source file every time the source changes? I have a
> package that I am modifying and unfortunately I am introducing errors.
> When I fix the errors though I cannot reload the package so I have to
> quit and restart the kernel. Hardly elegant by any measure.
>
> Thanks in advance,
>
> --
> Sseziwa Mukasa Business phone (direct) : (978) 536-2359
> JEOL USA INC (operator) : (978) 535-5900
> 1 Intercontinental Way
> Peabody, MA 01960 email: mukasa at jeol.com
> USA
>
>
>
>