Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: suppressing initialization
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Frank Beatrous

Posts: 2
Registered: 12/7/04
suppressing initialization
Posted: Jul 28, 1996 11:24 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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+@pitt.edu







Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.