I wrote a package (call it "ThisPackage`") that uses
DeclarePackage["OtherPackage`", {"BigVariable"} ]. The idea was to prevent
the loading of a large file in routine cases. However, when ThisPackage`
defines its functions, inside the Private` area, it includes a conditional
call to BigVariable. It turns out that OtherPackage is loaded when that
function is defined. I was wondering if there is a way to avoid this.
Roughly speaking, here is the setting:
BeginPackage[ "OtherPackage`" ]
BigVariable::usage="example
Begin[Private`]
BigVariable=Table[x y,{x,1000},{y,1000}]
End[ ]
EndPackage[ ]
BeginPackage[ "ThisPackage`" ]
function::usage="example
Begin[Private`]
function[x_]:=Module[{y},
y=If[x>1000,BigVariable[[x]],x] ]
End[ ]
EndPackage[ ]
I don't want OtherPakage to be loaded unless function[x] is called with
x>1000 but it loads when function is defined. Any ideas?
Thanks!
Nicholas