Re: Share symbols among packages
- To: mathgroup at smc.vnet.net
- Subject: [mg97372] Re: Share symbols among packages
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Thu, 12 Mar 2009 02:16:51 -0500 (EST)
- References: <gp82if$2l4$1@smc.vnet.net>
Hi, > How to use Global symbols in several user packages? you shouldn't :-), but it's possible anyway: > That is, I have: > > BeginPackage["MyPack1`"] > > myVar::usage="My var"; > > myFun1::usage="My fun1"; > > Begin["`Private`"]; > ... > (* use myVar *) > ... > End[] > EndPackage[] > changing the code of the second package to: BeginPackage["MyPack2`",{"MyPack1`"}] myFun2::usage="My fun2"; Begin["`Private`"]; (* use myVar *) End[] EndPackage[] should work, the second argument to BeginPackage imports the packages listed. Of course you might want to use a third package which contains just the globals and import that to both packages... hth, albert