MathGroup Archive 1996

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

Search the Archive

suppressing initialization

  • To: mathgroup at smc.vnet.net
  • Subject: [mg4523] suppressing initialization
  • From: beatrous+ at pitt.edu (Frank Beatrous)
  • Date: Wed, 7 Aug 1996 04:17:33 -0400
  • Organization: University of Pittsburgh
  • Sender: owner-wri-mathgroup at wolfram.com

I would like to find a clean way to suppress the loading of a package
that's defined in initialization cells of notebooks when the package is 
already loaded at the time the notebook is initialized.  The "obvious" 
thing to do is to put code something like this in the initialization:

If[!MemberQ[$Packages,"mystuff`"],
  BeginPackage["mystuff`"];
    x::usage="This should go in the context mystuff`.";
  Begin["`Private`"];
    x = a;
    y = b;
  End[];
  EndPackage[];
]

Unfortunately, the symbols x and y both land in the Global`
context instead of mystuff` and mystuff`Private` where they
belong. Evidently, the code inside of If[] uses its own local
version of $Context, rather than the global one that's
manipulated by BeginPackage[] and Begin[].

I know that I could use Needs[] if I put the package definitions
ins a separate file, but that won't do, since I want the
notebooks to work on computers that may not have the package
files installed. Any suggestions?

  Frank Beatrous
  beatrous+ at pitt.edu

==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Re: differential equations
  • Next by Date: Re: Re: Help with ParametricPlot3D in color
  • Previous by thread: Re: Piecewise Functions
  • Next by thread: Re: suppressing initialization