Re: Remove help
- To: mathgroup at smc.vnet.net
- Subject: [mg42025] Re: Remove help
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 17 Jun 2003 05:42:46 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <bcjvql$i1s$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
insert
If[MemberQ[Names["Global`*"], "rpm"],
Remove[Global`rpm]
]
before the BeginPackage[] command.
Regards
Jens
Rex_chaos wrote:
>
> hi all,
>
> I have defined a variable rpm in my-own-create package MyPackage`OWM
>
> Here is some code call the variable rpm defined in OWM
> In[1]:= rpm = \[Delta]; (* defined in Global context *)
> In[2]:= << MyPackage`OWM`
> In[3]:= rpm (* defined in OWN and the value is \[Gamma] *)
> Out[3]= \[Delta]
>
> However, it reports
>
> rpm::"shdw": "Symbol rpm appears in multiple contexts
> {"MyPackage`OWM`", "Global`"}; definitions in context
> {"MyPackage`OWM`"} may shadow or be shadowed by other
> definitions."
>
> In order to let rpm return the value defined in the package rather
> then that defined in Global context. I inserted the code into my
> package
>
> Remove[rpm];
> rpm = \[Gamma];
>
> Though it works. The message still be printed by mathematica. However
> can I get rid of the message?
>
> BTW, if rpm has never been defined in the Global context. Invoking
> "Remove[rpm]" will print a warning. However can I know if a variable
> has been defined or not?