MathGroup Archive 2010

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

Search the Archive

Re: Run Package vs Needs

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110659] Re: Run Package vs Needs
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Thu, 1 Jul 2010 08:26:06 -0400 (EDT)

On 6/30/10 at 1:50 AM, miguel at galrinho.com (Miguel Galrinho) wrote:

>I have a package in Mathematica that works fine when I open the .m
>file and click "Run Package". However, when I type Needs[.] in a
>notebook, the package doesn't load 100%, only some functions do. The
>file begins with

>BeginPackage[".", {.}]

>like I think it was supposed to. I don't know what might be wrong.

>Can anyone help?

Your BeginPackage call looks like it would be a problem.
Choosing a one character name for the context name is a poor
choice. And it is a particularly poor choice to use a character
such as a single "." that is used extensively for other purposes
and could result in conflict and unpredictable behavior.

Next, the second argument to BeginPackage is optional and used
to cause another package to load that the package you are
creating depends on. This argument is a list of *strings* not a
single . character. It should be possible to make this second
argument something that evaluates to a list of strings. But
clearly a single . character won't do this. And if the list
contains the same string as used to name the context being
defined by BeginPackage (the first argument) there is certainly
going to be a problem of some sort.

Try changing BeginPackage[".", {.}] to say
BeginPackage["myPackage"] and see if this helps.

If this doesn't fix the problem, you will need to supply more
detail of what you are doing. Do you have a private context
declared within the context you are setting up with
BeginPackage? If so, you will need public usage messages for
those functions defined inside the private context to easily
access them outside of the private context.

Also, when you say not all of the functions are loading how are
you determining that?



  • Prev by Date: Re: Lauching application from an icon
  • Next by Date: Need to Speed up Position[]
  • Previous by thread: Re: Run Package vs Needs
  • Next by thread: Re: Run Package vs Needs