I'm building a Mathematica application "APPStestI" that contains three packages: SUBappsA.m, SUBappsB.m, SUBappsC.m and APPStestI.m. Where APPStestI.m is the main package; SUBappsA.m and SUBappsB.m contains some functions and SUBappsC.m stores the values of the constants used by other packages.
init.m
Get[ "APPStestI`APPStestI`"]
Get[ "APPStestI`SUBappsA`"]
Get[ "APPStestI`SUBappsB`"]
Get[ "APPStestI`SUBappsC`"]
APPStestI.m
BeginPackage["APPStestI`"]
Print [Style[" Mathematica application ","Text"]];
EndPackage[]
SUBappsA.m
In this package we use the stored value of x.
BeginPackage["APPStestI`SUBappsA`"]
Get[ "APPStestI`SUBappsC`"]
Unprotect["SUBappsA`*"];
ClearAll["SUBappsA`*"];
funI::usage = "funI[ x]"
Begin["`Private`"] (* Begin Private Context *)
funI[xp_] := Module[ {yp}, yp = xp^2+x; yp + 1 ]
End[] (* End Private Context *)
Protect["SUBappsA`*"];
EndPackage[]
SUBappsB.m
In this package we use the stored value of WW.
BeginPackage["APPStestI`SUBappsB`"]
Get[ "APPStestI`SUBappsA`"]
Get[ "APPStestI`SUBappsC`"]
Unprotect["SUBappsB`*"];
ClearAll["SUBappsB`*"];
funII::usage = "funII[w] computes a simple function."
Begin["`Private`"]
funII[ wp_] := Module[ {zp}, zp = wp^3+ funI[WW]; zp + 1]
End[]
Protect["SUBappsB`*"];
EndPackage[]
SUBappsC.m
BeginPackage["APPStestI`SUBappsC`"]
Unprotect["SUBappsC`*"];
ClearAll["SUBappsC`*"];
y::usage= "5"
WW::usage= "10"
x::usage= "3"
z::usage= "4"
Begin["`Private`"]
{ y = 5, WW = 10, x = 3, z = 4 };
End[]
Protect["SUBappsC`*"];
EndPackage[]
Then loading APPStestI the following is shown:
<< APPStestI`
z::shdw: Symbol z appears in multiple contexts {APPStestI`SUBappsC`,Global`}; definitions in context APPStestI`SUBappsC` may shadow or be shadowed by other definitions.
The application performs the operations correctly, but I can not solve this problem.