MathGroup Archive 2006

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

Search the Archive

Re: Problem in loading packages in Mathematica

  • To: mathgroup at
  • Subject: [mg70689] Re: Problem in loading packages in Mathematica
  • From: Bill Rowe <readnewsciv at>
  • Date: Mon, 23 Oct 2006 02:50:27 -0400 (EDT)

On 10/22/06 at 1:19 AM, hpr at (Helen Read) wrote:

>I believe that in newer versions of Mathematica (certainly 5.x,
>maybe earlier),  loading a package with <<  does exactly the same
>thing as Needs, and there is no problem with loading twice the way
>there used to be.

This is not correct. Whether there is a problem or not with 
loading a package twice depends on how the package is written. 
To demonstrate this save the following code as testPkg.m


userFunction::usage="usage message"


userFunction[]:="user function results"




You will find that if you attempt to load this package a twice 
using Get or <<, you will get an error message. But you will not 
get an error message with Needs.

Now I can prevent the error message using Get by deleting the 
line with Protect or adding


after BeginPackage statement.

>I have had problems getting Needs to work on some
>systems, and have gone over completely to << with no problems

I can believe this. A well written package will allow the user 
to load it twice in whatever way the user chooses to load the package.
To reply via email subtract one hundred and four

  • Prev by Date: question ,,thankx!!!
  • Next by Date: RE: Using "=" vs ":="
  • Previous by thread: Re: Re: Problem in loading packages in Mathematica
  • Next by thread: "short circuiting" And and Or