MathGroup Archive 1997

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

Search the Archive

package impasse?

  • To: mathgroup at
  • Subject: [mg6213] package impasse?
  • From: murray at (Murray Eisenberg)
  • Date: Thu, 27 Feb 1997 02:55:27 -0500
  • Sender: owner-wri-mathgroup at

In previous postings, I described in more or less detail a problem I
have with implementing a package.  Please tell me if my conclusion
about this is correct.

A user defines a certain function f, which in turn may reference other
user-defined objects g and c.  These _other_ names are unknown to the package
designer (me)!

The package doesn't export anything.  What it does do is evaluate the
user's f at certain arguments supplied within the package.

Since the user-defined objects upon which f depends have names unknown
to the package, the StartPackage expression must be of the form

   StartPackage["thepackage`", "Global`"]

Hence (and this is what I'm asking about):  there is NO WAY to prevent
name clashes between objects created within the package and objects
created by the user -- other than the package's trying to use very
cryptic and obscure names, of course.

If the user's f was self-contained, or depended only upon objects
whose names were known in advance to the package designer, then of
course there's no problem: avoid including "Global`" in StartPackage
and instead refer to f within the package as Global`f.  But that's not
the realistic situation here.

If I am correct, then this seems a fatal shortcoming of Mathematica's
implementation of namespaces via contexts.

If I am incorrect, then I anxiously await a solution!

  Murray Eisenberg                       Internet:  murray at
  Mathematics & Statistics Dept.            Voice:  413-545-2859 (W)
  University of Massachusetts                       413-549-1020 (H)
  Amherst, MA 01003                           Fax:  413-545-1801

  • Prev by Date: Re: Output in C form
  • Next by Date: Triangulation methods
  • Previous by thread: Showprogress
  • Next by thread: Re: package impasse?