Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Package dependencies

  • To: mathgroup at
  • Subject: [mg45688] Package dependencies
  • From: Maxim <dontsendhere@.>
  • Date: Tue, 20 Jan 2004 05:07:59 -0500 (EST)
  • Sender: owner-wri-mathgroup at

Suppose we have a package a.m defining function f:

f[0] = 0

Then we create package b.m which introduces additional definitions for

f[1] = f[0] + 1

Now after loading b.m we'll have f[0]=0 and f[1]=1. Finally, we want to
create a package c.m that determines when b.m should be autoloaded. We
add the following line to c.m:


Unfortunately, it doesn't work that way:



(standalone kernel will also give f::shdw warning). The reason is that
DeclarePackage creates symbol f (with attribute Stub) in the b` context.
This implementation decision seems rather questionable: the idea of
DeclarePackage is to load b.m when f is first used, which is exactly
what we want here -- but nobody said the symbol f was needed in context

Probably this difficulty can be avoided by some creative usage of Remove
and $NewSymbol, but simply adding Remove["b`f"] to b.m won't solve the
problem completely.

This is exactly the situation with Geometry\Polytopes.m,
Graphics\Polyhedra.m and Graphics\Kernel\init.m -- you can use
<<graphics` to declare most of the symbols in all the Graphics\*
packages, but not Tetrahedron, Cube and others because there are
definitions for them both in Polytopes.m and Polyhedra.m.

Maxim Rytin
m.r at

  • Prev by Date: Re: Loading a Package
  • Next by Date: Tail recursion and local functions
  • Previous by thread: Re: AW: Loading a Package
  • Next by thread: Re: Package dependencies