MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: calling routine before Needs[]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg17161] Re: calling routine before Needs[]
  • From: dreiss at !SPAMscientificarts.com (David Reiss)
  • Date: Sun, 18 Apr 1999 00:59:45 -0400
  • Organization: EarthLink Network, Inc.
  • References: <7f9fh4$51o@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <7f9fh4$51o at smc.vnet.net>, Dan Truong <dtruong at irisa.fr> wrote:

> When a user calls a routine prior to the Needs[] or Get[] then
> he automatically defines the routine.
> However, when the package is loaded afterwards, since the routine
> is already defined, the true routine from the package cannot be
> used (you get a warning though).
> 
> When one writes a package, how can he guarantee that the routines of
> the package will override previous definition?
> I get nowhere with Clear[] or ClearAll[], Remove["Global`*RoutineName"]
> seems
> to work but will generate a warning if the user didn't make any mistake.
> Is there a standard/systematic method to tackle this problem?
> 
> 
> Another point:
> In my package I need global variables to hold informations
> - Is it legal (it seems possible at least) to declare variables in the
> package (ie package variables declared outside the routines of the
> package).
> When a notebook is saved as a package (.m file) it seems everything is
> removed but function declarations.
> - Another solution is to have a routine to build global variables at
> initialization. How can we tell a variable does not exist? Is there a
> routine like ExistQ or DefinedQ[] ?

With regard to the last question, consider using the function Unique:

In[1]:= ?Unique

"Unique[ ] generates a new symbol, whose name is of the form $nnn. Unique[x] 
generates a new symbol, with a name of the form x$nnn. Unique[{x, y, ... }] 
generates a list of new symbols. Unique[\"xxx\"] generates a new symbol, with 
a name of the form xxxnnn."

--David

-- 


   
----------------------------------------
 
Scientific Arts:
Creative Services and Consultation 
for the Applied and Pure Sciences
 
  http://www.scientificarts.com

David Reiss 
Email: dreiss at !SPAMscientificarts.com 

----------------------------------------
 


Remove the !SPAM to send email


  • Prev by Date: Display cannot be used during intialization message
  • Next by Date: Re: Re: BesselJZeros problem/bug?
  • Previous by thread: calling routine before Needs[]
  • Next by thread: Re: calling routine before Needs[]