MathGroup Archive 2004

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

Search the Archive

Re: No Output, No Error

  • To: mathgroup at
  • Subject: [mg46461] Re: No Output, No Error
  • From: Bill Rowe <readnewsciv at>
  • Date: Thu, 19 Feb 2004 03:02:19 -0500 (EST)
  • Sender: owner-wri-mathgroup at

On 2/18/04 at 12:37 AM, jackson101 at (Jackson) wrote:

>Exactly! I tried the package load before asking for help and it
>still didn't work. After reading this (and other replies), I
>started a new test from scratch and now it works. I didn't think
>about the local variable overwriting the package variable.

It isn't that the local variable overwrites the package variable.

When you type the name of a function in a package before loading the package, you create a symbol with that name in the Global context. Then when you later load the package, you create a second symbol with the same name in the package context. 

Later, when you ask Mathematica to evaluate the function, the Global context is checked first. Mathematica finds a symbol with that name but nothing to evaluate. This results in the behaviour you saw. Mathematica never sees the definition in the package context since it stops looking once it has found any symbol with that name. This problem is known as shadowing.

There are a few useful utilities on the Mathematica Resources site for dealing with this problem. Search for anti-shadow or shadow and you should turn up these utilities.
To reply via email subtract one hundred and four

  • Prev by Date: RE: A New Kind of Science Online
  • Next by Date: bug in integration with version 5.0 ?
  • Previous by thread: Re: No Output, No Error
  • Next by thread: RE: Re: No Output, No Error