MathGroup Archive 2000

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

Search the Archive

Re: Needs[] and <<

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23065] Re: [mg23036] Needs[] and <<
  • From: Jean-Marie Thomas <jmt at agat.net>
  • Date: Sat, 15 Apr 2000 03:00:24 -0400 (EDT)
  • Organization: TeA
  • References: <200004130643.CAA24815@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Get[] (or <<) reads a file.
If the file is a package, the name of the package is added to the global
variable $Packages which is the list of all loaded packages (BeginPackage does
this work).

Needs checks $Packages, and if the package is not present, reads the file.

Then :
- if you are developing a package, I suggest to use Get, implying that a
new read will update modification you have done to your package code.
- if the package code is frozen (i.e. you won't modify it during the session),
I suggest to use Needs, meaning the file will only be read once. 
Needs is then useful when you call a series of packages, some of them depending
on a certain package you need to declare in each package, but is only read once.

jmt





On Thu, 13 Apr 2000, Hans Friedrich Steffani wrote:
> Why does the examples in the Mathematica book say
> << Graphics`Graphics`
> instead of
> Needs["Graphics`Graphics`"]
> ?
> 
> Hans Friedrich Steffani
> 
> 
> -- 
> Hans Friedrich Steffani
> Institut fuer Elektrische Maschinen und Antriebe, TU Chemnitz
> mailto:hans.steffani at e-technik.tu-chemnitz.de
> http://www.tu-chemnitz.de/~hfst/


  • References:
    • Needs[] and <<
      • From: hans.steffani@e-technik.tu-chemnitz.de (Hans Friedrich Steffani)
  • Prev by Date: Re: Add Fonts when using Display[]
  • Next by Date: breaking up lists into intervals
  • Previous by thread: Needs[] and <<
  • Next by thread: Re: Needs[] and <<